|
If I understand you correctly, you want the user to see one thing.. say a Customer Name, but you want to use a different value, say Customer ID.. This is very easy to do.. Set the DataSource of the ComboBox (ComboBox.DataSource) and then set the ComboBox.DisplayMember for what to be displayed and the ComboBox.ValueMemeber for what the value of that item should be... example:
<br />
ComboBox myCombo = new ComboBox();<br />
myCombo.SelectedValueChanged += new System.EventHandler(this.myCombo_SelectedValueChanged);<br />
<br />
DataTable myDataTable = new DataTable();<br />
<br />
myDataTable.Columns.Add("Customer Name");<br />
myDataTable.Columns.Add("Customer ID");<br />
<br />
DataRow myRow = myDataTable.NewRow();<br />
myRow["Customer Name"] = "Joe Smith";<br />
myRow["Customer ID"] = "1024";<br />
myDataTable.Rows.Add(myRow);<br />
<br />
myCombo.DataSource = myDataTable;<br />
myCombo.DisplayMember = myDataTable.Columns["Customer Name"].ToString();<br />
myCombo.ValueMember = myDataTable.Columns["Customer ID"].ToString();<br />
<br />
private void myCombo_SelectedValueChanged(object sender, System.EventArgs e) {<br />
MessageBox.Show("Display: " + myCombo.Text + " - " + "Value: " + myCombo.SelectedValue.ToString());<br />
}<br />
hope this helps!
|
|
|
|
|
How do I set up the parameters and call
Private Declare Function OleCreatePictureIndirect _
Lib "olepro32.dll" (PicDesc As PicBmp, RefIID As GUID, _
ByVal fPictureOwnsHandle As Long, IPic As IPicture) As Long
from C# and retreive the returned picture(image?)?
Thanx in advance
LLINF
LLINF
|
|
|
|
|
i'm having trouble reading from a port using .net 2003,the trouble being that i can't figure out how to do it. how do you create a serialPort object in 2003?
|
|
|
|
|
I want to get C to C# code converter. Could anyone please help me in this regard.
|
|
|
|
|
|
Can I atleast get a C to Java code converter ?
|
|
|
|
|
|
Mohammed Aijaz Mohiuddin wrote:
Can I atleast get a C to Java code converter ?
I'll repeat my previous response because it continues to be valid:
It's not going to happen. The two languages are too different. It is possible between languages that both use the .NET framework as a converter only has to deal with the syntax of the language (as both languages share the same framework).
I've put in bold the only condition in which it is possible.
Do you want to know more?
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums
|
|
|
|
|
Mohammed Aijaz Mohiuddin wrote:
I want to get C to C# code converter. Could anyone please help me in this regard.
You can compile it in C using the Managed C++ compiler, create a wrapper class and then call it from C#.
Yes, even I am blogging now!
|
|
|
|
|
Hi
I have a problem... how should be look to find something like this:
HELP!
|
|
|
|
|
if you want to find something like this:
then you do,
string to_find = null;
hint hint, in future, check your posts, cause I think you were missing something.
|
|
|
|
|
Heh
I forget check box: Do not treat <'s as HTML tags
There should be: <a href="*.jpg">*</a>
Greetings
|
|
|
|
|
Hi everybody,
I am new in C#.net
My question is that: I am doing a porject with windows applicaitons. I have 2 formsand from the first form I am getting the number of textbox which will be produced in the second form. I want that when the user clicks the button on the second form the values of the textboxes will be saved into the database.
I am producing textboxes but have not yet got the values of them. Could you please hepl me?
|
|
|
|
|
Hello
In windows forms i have some TextBox that are binding to my Dataset.I want to get the current row to set my DataRow for delete the current row ,for using objDataRow.Delete() method
How i can do it ?
|
|
|
|
|
is there any way to generate xml file from existing schema in C#?
|
|
|
|
|
|
there is a client and server side. it seems that when i run from the solution, the functions are working properly. but when i run using the .exe file, bugs started to occur. is there someway how i can debug?
|
|
|
|
|
|
i am sending a string to the server. then the server sends this string to other clients (which is tokenized and placed in respective listboxes). there seems to have a duplicate strings existing, and sometimes, no list appears. this also happens when removing a string from the listbox. it does not remove at all.
if there are three or more clients, some clients' listbox is updated while some are not.
what could be the problem?
it only occurs when i run the exe file.
|
|
|
|
|
you may try this.
http://www.codeproject.com/books/0735616485.asp[^]
though, there are many other articles on regular expressions. just search cp for "regular expressions" under c#. or even google it. there are so many resources for reg exp. it seems like all of a sudden.
|
|
|
|
|
Hi All ,
how can i run that winrar command from my code the following is an example of that command
winrar a D:\First.rar D:\first.txt
i made it run from Startmenu-->Run
i tried to run it using
System.Diagonistic.Process
but it always fail because it ecpect to find a flie that can be opened
can you help me to find any way
thank you,
Shady
|
|
|
|
|
You'll have to find where winrar.exe is stored on your computer and then give Process.Start() the full path.
mav
|
|
|
|
|
Dear mav.northwind ,
i tried what you sent me but the same error appeared
and that what i typed :
Process.Start(@"C:\WinRAR\WinRAR a D:First.rar D:first.txt");
|
|
|
|
|
|
Id like to add colored rows for index dividers. I'm not sure how to change the background color of a single row or overwrite a paint method for a single row?
|
|
|
|