Search Results

Search found 4334 results on 174 pages for 'sender'.

Page 109/174 | < Previous Page | 105 106 107 108 109 110 111 112 113 114 115 116  | Next Page >

  • C#: Select row from DataGridView

    - by Bi
    Hi I have a form with a DataGridView (of 3 columns) and a Button. Every time the user clicks on a button, I want the get the values stored in the 1st column of that row. Here is the code I have: private void myButton_Click(object sender, EventArgs e) { foreach (DataGridViewRow row in ProductsGrid.Rows) { if (this.ProductsGrid.SelectedRows.Count == 1) { // get information of 1st column from the row string value = this.ProductsGrid.SelectedRows[0].Cells[0].ToString(); } } } However when I click on myButton, the this.ProductsGrid.SelectedRows.Count is 0. Also, how do I ensure that the user selects only one row and not multiple rows? Does this code look right?

    Read the article

  • Objective-c when to release objects

    - by Chris
    -(IBAction)registerUpdate:(id)sender { HTTPRequest* request = [[HTTPRequest alloc] initWithUrl:@"http://www.yahoo.com" delegate:self]; [request doRequest]; } The HTTPRequest makes an asynchronous request and calls the onHTTPResponse method in the current class. My question is do I have to release request? My guess is that I'm supposed to make it an instance variable? [NSString stringWithFormat:@"Data received: %@", [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding]]; How would I release that string object, or should I assign it to a variable?

    Read the article

  • how to get the properties of a bitmap?

    - by BlueMonster
    How would i grab a bitmap's copyright date? I've been googling around for some pointers in the right direction, can't seem to find much though. Any ideas? private void toolStripMenuItemLoadImage_Click(object sender, EventArgs e) { using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.Title = "Load Image"; if (ofd.ShowDialog() == DialogResult.OK) { firstLoaded = new Bitmap(ofd.FileName); String details = //Grab the copyright date of the image here; this.Invalidate(); } } isLoaded = true; }

    Read the article

  • how toaccess the attributes in another form? c#

    - by Chelsea_cole
    I have a problem in a same namespace: public partial class frmForm1 : Form // Form1 { public class Account { public string Username; public string Password; } public class ListAcc { public static int count = 0; private static List<Account> UserList; public static List<Account> Data() { return UserList; } } } public partial class frmForm2 : Form // Form2 { private void button2_Click(object sender, EventArgs e) { frmForm1.Account A; string m = frmForm1.ListAcc<A>.[0].Username; //ERROR } } How could i access the attributes (Username, Password...) in frmForm1? Someone help me? Thanks!

    Read the article

  • Change CaretIndex for 2.0

    - by pipelinecache
    Hi everyone, I'm having a problem that I don't want use .NET Framework 3.0/3.5 allready. So I want to change the CaretIndex for something usefull in 2.0? Does anyone have an idea how to do this. This is the CaretIndex example I have: Regex reg = new Regex(@"^\d{1,10}$", RegexOptions.Singleline); TextBox textBox = sender as TextBox; if (textBox.Text == string.Empty) { return; } string newText = reg.Replace(textBox.Text, string.Empty); if (newText != textBox.Text) { int caretIndex = textBox.CaretIndex ; textBox.Text = newText; if (caretIndex > 0) { textBox.CaretIndex = caretIndex - 1; } }

    Read the article

  • c# xml function to check whether a string is equal to a xml attribute, to add selected combobox item

    - by fuch
    i want to check the combobox.selecteditem.tostring() on combobox select in a given xml with several nodes, where each one has an attribute called "name" private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { try { textBox1.AppendText(nameAttributeCheck(comboBox1.SelectedItem.ToString())); } catch { } } private string nameAttributeCheck(string a) { XmlDocument doc = new XmlDocument(); doc.Load("armor.xml"); XmlElement root = doc.DocumentElement; XmlNodeList items = root.SelectNodes("/items"); String result = null; try { foreach (XmlNode item in items) { if (string.Equals(a, item.Attributes["name"].InnerText.ToString())) { result += item.Attributes["picture"].InnerText.ToString(); } } } catch { } return result; } each time i try it, nothing happens

    Read the article

  • website inserting pics

    - by onfire4JesusCollins
    Hello i am getting this error message : Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: Line 7: Line 8: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Line 9: UserIdValue.Text = Membership.GetUser().ProviderUserKey.ToString() Line 10: cannotUploadImageMessage.Visible = False Line 11: End Sub can someone help me with this?

    Read the article

  • C#: Using regular expression (Regex) to duplicate a specific character in a string

    - by user3703944
    Anyone know how to use regex to duplicate a specific character in a string? I have a path that is entered like this: C:/Example/example I would like to use regex (or any other method) to display it like this: C://Example//example Is it possible? This is where I'm getting the file path private void btnSearchImage_Click_1(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp"; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string filenName = ofd.FileName; pictureBox1.Image = new Bitmap(filenName); string path = filenName; txtimgPath.Text = path; } } Thanks

    Read the article

  • Set a tab page on lload event of a form

    - by tanu
    i have a form with many tabs on it. I want to set a specific tab page to show on load of the form everytime i load the form I used TabPageControl1.SelectedTab=MyTabPage; but the value of selectedtab is null. It is throwing an exception that reference not set to an object. private void PreferencesForm_Load(object sender, EventArgs e) { this.cbxCustomDataType.DrawMode = DrawMode.OwnerDrawFixed; this.cbxCustomDataType.DrawItem += new DrawItemEventHandler(cbxCustomDataType_DrawItem); this.cbxColumnDataType.DrawMode = DrawMode.OwnerDrawFixed; this.cbxColumnDataType.DrawItem += new DrawItemEventHandler(cbxColumnDataType_DrawItem); GetProjectDetails(); this.preferencesTabControl.SelectedTab= tpCompareUpdate; }

    Read the article

  • When would I need to call base() in C#?

    - by user310291
    My BaseClass Constructor is called whereas I have a constructor in derived class so when would I need to call base() ? class BaseClass { public BaseClass() { Debug.Print("BaseClass"); } } class InheritedClass : BaseClass { public InheritedClass() { Debug.Print("InheritedClass"); } } private void Form1_Load(object sender, EventArgs e) { InheritedClass inheritedClass = new InheritedClass(); } Output 'Inheritance.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Accessibility\v4.0_4.0.0.0__b03f5f7f11d50a3a\Accessibility.dll' 'Inheritance.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. BaseClass InheritedClass The thread 'vshost.RunParkingWindow' (0x12b4) has exited with code 0 (0x0). The thread '<No Name>' (0x85c) has exited with code 0 (0x0). The program '[4368] Inheritance.vshost.exe: Program Trace' has exited with code 0 (0x0). The program '[4368] Inheritance.vshost.exe: Managed (v4.0.30319)' has exited with code 0 (0x0).

    Read the article

  • Access a viewControllers View

    - by iFloh
    Hi, I am trying to get to grips with programmatically configuring views. I have a UIViewController and want to add a UIButton to its view. Well, I created the button: UIButton *newViewButton = [[UIButton alloc] initWithFrame:CGRectMake(baseX + viewPlusX, baseY + viewPlusY, viewWidth, viewHeight)]; [newViewButton setTitle:@"View" forState:UIControlStateNormal]; [newViewButton setTag:(int)key]; [newViewButton addTarget:myViewController action:@selector(viewButton:sender) forControlEvents:UIControlEventTouchUpInside]; but when trying to add it to the view [myViewController addSubview:newViewButton]; I get the error error: expected ':' before":" token any clue what I am doing wrong regards

    Read the article

  • How i can to Destory(free) a Form from memory?

    - by user482923
    Hello, i have 2 Form (Form1 and Form2) in the my project, Form1 is Auto-create forms, but Form2 is Available forms. how i can to create Form2 and unload Form1? I received a "Access validation" Error in this code. Here is Form1 code: 1. uses Unit2; //********* 2. procedure TForm1.FormCreate(Sender: TObject); 3. var a:TForm2; 4. begin 5. a := TForm2.Create(self); 6. a.Show; 7. self.free; // Or self.destory; 8. end; Thanks.

    Read the article

  • C# background worker while loop

    - by Mike
    What i'm trying to create is a background worker that executes a few processes every 30seconds. But I want this while loop to execute for as long as the program is launched. here is what I am using: private void watcherprocess1() { backgroundWorker1.RunWorkerAsync(); } private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { while( Thread.Sleep(30000); specficView2(); makeFormlist2(); populateListview2(); } My main issue is ai can think of a good while loop to keep this running

    Read the article

  • WndProc to detect device unplug and plug

    - by Kev Fixx
    How can I know a devices is plug or unplug in WPF? I am using the code below to detect device changes: private void OnSourceInitialized(object sender, EventArgs e) { IntPtr windowHandle = (new WindowInteropHelper(this)).Handle; HwndSource src = HwndSource.FromHwnd(windowHandle); src.AddHook(new HwndSourceHook(WndProc)); } private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { // Handle WM_DEVICECHANGE... if (msg == 0x219) { InitHead(); } return IntPtr.Zero; } Thank you. EDITED: I did the below, still not working: if (msg == 0x0219) { switch (wParam.ToInt32()) { case 0x8000: { InitHead(); } break; } }

    Read the article

  • Hilighting div tag in Masterpage on redirection to content page

    - by user1713632
    I have a link in Master page within a div tag. I want to highlight the div when I am clicking the link, in order to redirect to some content page. I have written the following code: <li> <div id="div_test" runat="server"> <asp:LinkButton ID="lnk_test_menu" Font-Underline="false" ForeColor="Black" runat="server" Text="Test Link" CausesValidation="false" onclick="lnk_test_menu_Click1" > </asp:LinkButton></div> </li> Code in the cs page: protected void lnk_test_menu_Click1(object sender, EventArgs e) { div_test.Attributes.Add("class", "testSelected"); Response.Redirect(Test.aspx"); } The div in the master page is not being selected on redirection. Could anybody help me on this?

    Read the article

  • How to move to another view without using a button

    - by Will
    My first view displays an image and action indicator while web-servers and database function are run in that background. I want the application to go to my tab view when the functions have been completed. How do I do this? Here is what the views look like. What I have tried: TabBarViewController *tab = [[TabBarViewController alloc]init]; [self presentViewController:tab animated:NO completion:nil]; and [self performSegueWithIdentifier:@"first" sender:self]; Please can you help my to understand how to do this. I have spent many hours googling this problem and couldn't work out how to do it. Thanks EDIT: Added Code

    Read the article

  • Checking for a session variable... returns (Object reference not set to an instance of an object.)

    - by Chocol8
    In the Session_Start i have Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) Session("login") = False End Sub and in a custom .aspx page i included the following... Public ReadOnly Property GetLoginState() As Boolean Get If Current.Session("login") Is Nothing Then Current.Session("login") = False End If Return Current.Session("login") End Get End Property Why i am getting error the error Object reference not set to an instance of an object. at line If Current.Session("login") Is Nothing Then while checking for the login state as follows? If GetLogin = False Then 'Do something End if I mean i have already created the instance on the Session_Start... Haven't i? What am i doing wrong here?

    Read the article

  • C# string to combobox issues

    - by Mike
    What i'm trying to do is read in a header row of a file to a combobox. Here is my code: private void button4_Click(object sender, EventArgs e) { string[] startdelim = File.ReadAllLines(textBox1.Text); int counter = 1; foreach (string delim in startdelim) { if (counter == 1) { string removedelim = delim.Replace("\"", ""); string[] lines = removedelim.IndexOf(","); foreach (string line in lines) { comboBox1.Items.Add(line); } } counter++; } for some reason it keeps telling me Error Cannot implicitly convert type 'int' to 'string[]' at string[] lines = removedelim.IndexOf(",");

    Read the article

  • why can not see my method if i implamented interface to normal class?

    - by Phsika
    i can not see MyLoad.TreeLoader(.... but why i can not see? i implemented iloader to TreeViewLoad. i should see TreeLoader why? namespace Rekursive { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { //treeView1.Nodes.Add("Test"); iloader MyLoad = new TreeViewLoad(); MyLoad.loader("test", treeView1, 1); // i can not see MyLoad.TreeLoader(.... but why i can not see? // i implemented iloader to TreeViewLoad. i should see TreeLoader why? //TreeViewLoad myloader = new TreeViewLoad(); } } interface iloader { void loader(string nodeName, TreeView myTre, int id); } class TreeViewLoad : iloader { public void TreeLoader(TreeView tre) { // i will call loader... } public void loader(string nodeName, TreeView myTre, int id) { myTre.Nodes.Add(nodeName + id.ToString()); if (id

    Read the article

  • Need my video to loop please

    - by Jay L
    Hi all, Thank you in advance for any help, I am a newbie and would appreciate any help here.. I have this code to play a movie and it works great. Can somebody PLEASE tell me how to make this movie loop and replay from the beginning non stop ( any code would help). Also I would like to know how to play 2 movies, one after the other, preferably with a fade or smooth transition. Thank you for any help import "MyAppViewController.h" @implementation MyAppViewController -(IBAction)button:(id)sender{ NSString *path = [[NSBundle mainBundle] pathForResource:@"mymovie" ofType:@"mp4"]; player = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:path]]; [self presentMoviePlayerViewControllerAnimated:player]; }

    Read the article

  • Programmatically adding event handler to array of radio buttons

    - by gSaenz
    Trying to add event handlers to radio buttons that are created on user input, looking at this and this as examples. However I get an error that answerOptions is not an event. Create the radio buttons Private answerOptions(n) As RadioButton ... Private Sub showQuestion(n As Integer) For i = 0 To answerOptions.Length - 1 answerOptions(i) = New RadioButton AddHandler answerOptions, AddressOf Me.Radios_Click With answerOptions(i) ' --------- SET TEXT, LOCATION ETC. End With Me.Controls.Add(answerOptions(i)) Next End Sub Planning on then handling events with Private Sub Radios_Click(sender As Object, e As EventArgs) Handles answerOptions.checked End Sub I want things to happen when the radios are checked. Don't want to use checkboxes as I want to limit one selection at a time.

    Read the article

  • How to check the status (True/False) in a grid view on rowdatabound event?

    - by NayeemKhan
    Hi all, I have a table with three columns (ProdID,ProdName,Status). I m fetching that into a dataSet and binding that to my gridview. I have a very basic and simple rowdatabound event like this : protected void gvProducts_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.Cells[2].Text == "False") { e.Row.BackColor = System.Drawing.Color.PaleVioletRed; } } } But when i see my 3rd column (Status), it is converted to a checkbox, may be becz its containing only 'True' or 'False'. Also in my if condition : if (e.Row.Cells[3].Text == "False") the text value is showing this : "" Can anybody suggest me, how can i compare my status against True or False in my if condition.

    Read the article

  • Configure UIDatePicker with current locations time

    - by Telkitty
    I am using UIDatePicker in my current app, here is how I set a UILabel with the date time string obtained from the UIDatePicker. -(IBAction)AddTimeEnd:(id)sender { NSDate * date = [m_DateTimePicker date]; m_DateTimeLabel.text = [date description]; } Somehow the time I have entered (EST) kept on getting converted to US time in the UILabel. Does anyone know how to fix it? I would like the time entered in UIDatePicker to be consistent with the text in the label (probably the simplest way is set the locale for the UIDatePicker to be the local timezone)?

    Read the article

  • iPhone Application

    - by user553627
    Hello, Im working on an iPhone project using xcode and i actually have not programmed using objective-c before. So, my problem mainly is that my app crashes whenever i hit the button that it suppose to show a view of the world map. I think the problem is within the last 2 lines of the code but still i cant figure out why ?!! because whenever i comment out the line "[self presemtM.....]" the program doesn't crash. Would appreciate your help! -(IBAction) pushedGo:(id)sender { CLLocationCoordinate2D coord = {37.331689, -122.030731}; MapViewController *mapView = [[MapViewController alloc] initWithCoordinates:coord andTitle:@"Apple" andSubTitle:@"111"]; [self presentModalViewController:mapView animated:YES] [mapView release]; }

    Read the article

  • How do I reference a control in a different thread?

    - by Testifier
    //button is clicked //worker starts private void processWorker_DoWork(object sender, DoWorkEventArgs e) { string code = DoLongWorkAndReturnCode(); if (code != 0) { MessageBox.Show("Error!"); EnableAllButtons(); // this is defined in the other thread and it's where i run into the error. } else { string code = DoAnotherLongProcessAndReturnCode(); if (code != 0) { MessageBox.Show("Error 2!"); EnableAllButtons(); // again, this is defined in the other thread } } } I'm running into a cross threading error because "EnableAllButtons()" is defined in a different thread. How do I go about enabling all buttons in one thread, from a different thread?

    Read the article

< Previous Page | 105 106 107 108 109 110 111 112 113 114 115 116  | Next Page >