Click here to Skip to main content
15,886,778 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is there an easier way to load in a variable in a parameter?

I use two forms, on form1 stands a listbox. With the command 'listbox.selectedvalue.ToString()' in a button function i take the currentID of the selected-value to form2.

On Form 2 I charge this string in a label and this label I load the ID field as a parameter for my SQL code.


load string to label (form2)
xx_label1.text = IDField


Load the label into de parameter (form2)
command.parameters.addwithValue (@IDField, xx_label1.text);
Posted
Comments
Kornfeld Eliyahu Peter 24-Nov-15 8:49am    
Why that way is so hard on you, that you have to look for an easier one?
MaikelO1 24-Nov-15 9:56am    
The code works fine but I would like to keep the id-number in the code and not visualized on the layout.

So basically my question is. How can I use my ID-field only process in the code without showing it on the layout.
Kornfeld Eliyahu Peter 24-Nov-15 11:47am    
What wrong with...
command.parameters.addwithValue (@IDField, IDField);
ZurdoDev 24-Nov-15 8:50am    
I don't quite follow but it sounds like you need to pass in the id of the selected field. This approach should work fine, right?
MaikelO1 24-Nov-15 9:56am    
The code works fine but I would like to keep the id-number in the code and not visualized on the layout.

So basically my question is. How can I use my ID-field only process in the code without showing it on the layout.

1 solution

As discussed in comments, you can hide the field so users can't see it but can still pass the information around that way. It's a fine approach.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900