hi
can you tell me . How to pass form1 combobox values to form2 textbox using C#.net with sqlserver
Thanks®ards
Hemalatha.M
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Majid KamaliPosted Sep 16, 2010, 5:12 AM
You can create a Class with a constructor that gets a string as parameter. (You should do it in form1)
you can pass ComboBox1.SelectedItem.ToString() to that class and with an event give it in form2 and put it in TextBox1.Text.
I hope it helps.
Bruce RoeserPosted Sep 15, 2010, 10:25 PM
-bwr-
hemalathaPosted Sep 15, 2010, 10:20 PM
This is Hemalatha. That link is usefull for me but i want pass values from form1 combobox to form2 text in windows application .
Majid KamaliPosted Sep 15, 2010, 3:40 PM
If you are using Windows Application, See Link Below. It's a General way to pass data between two forms
http://www.c-sharpcorner.com/UploadFile/scottlysle/PassData01142007013005AM/PassData.aspx
hemalathaPosted Sep 15, 2010, 10:22 AM
hemalathaPosted Sep 14, 2010, 11:58 AM
i did not understand , can please tell clear , please send me sourcecode for that
Thanks & regards
Hemalatha.M
Imran PervezPosted Sep 14, 2010, 12:47 AM
2. u can store value in databse and call it by any form
if u got trouble continue mail me for example i send u
Bruce RoeserPosted Sep 13, 2010, 9:04 AM
I've attached a VS2008 project that demonstrates this.
-bwr-
Manikavelu VelayuthamPosted Sep 13, 2010, 7:06 AM
you can declare a public property in form1. Using get and set method try to retrieve and assign the values.
Below code should be written in form1.cs file
public string DisplayMessage {
get {
return comboBox1.SelectedItem.ToString();
}
}
Below code should be written in form 2
Form1 objfrm1 = new Form1()
textbox1.Text = objfrm1.DisplayMessage;
hemalathaPosted Sep 13, 2010, 4:20 AM
i want detail code for above question . please help me
Bruce RoeserPosted Sep 12, 2010, 4:41 PM
1) Create a static class in your project that could contain global variables. Then in the code where you call Form2 you could place the text value from the combo box which would be viewable by the 2nd form.
2) Design your 2nd form so that it's constructor takes an argument into which you could pass the value.
-bwr-