Question User Control

kenny.willems

New member
Joined
Feb 17, 2011
Messages
1
Programming Experience
Beginner
Hello everyone

I'm learning .NET and I've got a question about user controls. Let me explain my situation. I'm using VS 2010..

I've created an user control, which contains a textbox (code), a button and a label. When you fill in the textbox, the system searches of the codes exists, if so, the description is showed in the label, else it's cleared.

when you click the button, a form opens with a datagrid where you can select a code.
when you select a code in the datagrid, the code textbox should be filled in with the selected code.

how do you return the selected value to the custom control? I've created a public property in the custom control, but i can't access it.

thanks in advance
 
code in user control:
VB.NET:
If griddialog.ShowDialog = DialogResult.OK Then
    ' get information from the grid form
    Me.CodeTextBox.Text = griddialog.SelectedCode
End If
SelectedCode is a property you add to your grid form and return the code that was selected there.
 
Back
Top