Mike Eghtebas
asked on
C#, update a textbox value...
ReadFromDict <-- is an object
ReadFromDict.YYYYConrol <-- gives string like "yYYY_Left" and ReadFromDict.YYYY <-- gives string value like 2014
I am trying to put 2014 into the text box with the name as string "yYYY_Left". The following code doesn't work:
Thank you.
ReadFromDict.YYYYConrol <-- gives string like "yYYY_Left" and ReadFromDict.YYYY <-- gives string value like 2014
I am trying to put 2014 into the text box with the name as string "yYYY_Left". The following code doesn't work:
TextBox myTextBox =new TextBox(ReadFromDict.YYYYConrol);
myTextBox.Text = ReadFromDict.YYYY.ToString();
Question: Could you please show me how this is done?Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
re:> then just set the text
As stated in the original post, that is not an acceptable option. That requires many lines of code and difficult to maintain.
Mike
As stated in the original post, that is not an acceptable option. That requires many lines of code and difficult to maintain.
Mike
ASKER
re:> There is no TextBox constructor taking parameters and ....
That understood. Thanks for the info on that.
re:> you probably should add the new control somewhere...
Does this mean I cannot use the existing text boxes? It seems you are creating brand new text boxes. If so, is there any way to cycle through the text boxes on the form and when their name matches ReadFromDict.YYYYConrol then enter the string value in ReadFromDict.YYYY.ToString
Thanks,
Mike