Friday 15 March 2013

c# - How to set text box value depending on value from combo box? -


I am new to programming in C #, and now I'm applying C # windows form .... There are all the questions, but now can start with the next one:

Based on the selected value of the combo box, I would like to set the value in the text box ... how to do this in a simple way Do you?

I have this application database located near Dirtykala, which has 8 tables, for my last question, I am using ArtiLiki and Zapridgeini Artili tables. In a user control, the zidarmeljaniartili for the DataGrid view is in it's text box, no, sysindex and tip kiosks and combo box ean codes.

Based on the value selected from the combo box EAN code, I would now like to fill those text boxes automatically. For example: If the code is 00980 9 0076418, then the text box should contain values ​​as paragraph 7689855, Size Index 420 and Tip Cottage B14.

All of these criteria should be from the articular table, and after setting, they write in the data grid view (Zapirilgeni Arteri Table) ...

Thanks for you and my bad Sorry for the English.

If more information is needed then do not be a stranger, and insert me :)

Here is a preview of what I want to do ... bit.ly/12iSbmy And here's a full code that I'm using in that user control dropbox.com/s/25kqw4p1rjsx1o0/ ZaprimljeniArtili.txt for pasting it here for a long time so I give you a txt file, I hope that's fine ...

You can use one.

First of all, double click on your combo box, which will automatically create event handling for you, as well as take you to the call method.

You can use that method like this:

  Private Zero cmbMyComboBox_SelectedIndexChanged (Object Sender, EventArgs E) {// Get selected text, you selected selected Selected value string can be used by selectedText = cmbMyComboBox .SelectedText; Switch (selected text) // I am using a case because I do not know your data (case "some value": txtTextBox.Text = "some other value"; break; ...}}   

Using the key SelectedText (or one of the other versions) to retrieve the selected items. Then you can use it in your logic to populate other arguments.

I do not know correctly / you are collecting data, but it should take you in the right direction.

No comments:

Post a Comment