Natavia Finnie
asked on
vb.net How upload data from a .txt file into the controls on the UI using control name
Here is am example of my .txt file:
<%:cntrlName="cntrlSavedDa ta"\%>
<%:productionPlan=""\%>
<%:ProteinName="CP4 EPSPS"\%>
<%:historicalLotNum="20-10 0048"\%>
<%:ExpPlasmid="pMON21104"\ %>
please ignore <%:\%>
I want to be able to recursively add the data back to the textboxes and comboboxes using this format.
<%:cntrlName="cntrlSavedDa
<%:productionPlan=""\%>
<%:ProteinName="CP4 EPSPS"\%>
<%:historicalLotNum="20-10
<%:ExpPlasmid="pMON21104"\
please ignore <%:\%>
I want to be able to recursively add the data back to the textboxes and comboboxes using this format.
ASKER
@Fernando Soto, I am new to vb.net so you may have to be just a bit more detailed. Sorry....
When you say that to, please ignore <%:\%>, does that mean that it is not in the file?
ASKER
No that is in the file. If I was to use part of the current function it ignores those. Put if I was to write my own then DO NOT ignore.
In this case do not ignore because the .txt file is saved like the example that I gave.
That's all.....
In this case do not ignore because the .txt file is saved like the example that I gave.
That's all.....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Read each line of the file and parse it to control name and the value. Then on the Form that the control is on you can do the following.
Open in new window
Where the name is the control you need to update and True is to search ALL child controls. That method returns an array of controls. If the control was found it will be in position 0. Depending on which property you may be updating you may need to cast to the control type. For exampleOpen in new window
In this sample you can update the TextBox, tb, as needed.