المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : substring from form1 to form2....



C# Programming
03-15-2013, 11:52 AM
Hey CP,

Getting text from one form to another is no problem. But I am having issues showing data from a ComboBox from form1 to display as text in form 2. Alright let's jump right into my example.

string instText = comboInst.GetItemText(comboInst.SelectedItem);string folder = instText.Substring(0, 4);
comboInst is a combo box that has a list of items that is pulled from a directory. All items have a leading 4 digits that I use a lot in form1. But I can't get those 4 values for the life of me to show even in a messagebox on form 2. It just shows blank when using methods that pull information from a textBox.Text.

I need to be able to use both instText and folder strings in other forms.

Anyone got any ideas? The example I used is located on stackOverflow:
[/URL][[URL="http://stackoverflow.com/questions/7886544/passing-a-value-from-one-form-to-another-form"]^ (http://stackoverflow.com/questions/7886544/passing-a-value-from-one-form-to-another-form)]

Thanks!