I have the following piece of code:
private sub xtoy()
lbl_packed_as.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.DatasetProduct, "tbl_products.packed_fresh_or_frozen"))
end sub
and this:
Private Sub lbl_packed_as_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lbl_packed_as.TextChanged
Select Case lbl_packed_as.Text
Case "FR"
rdb_fresh.Checked = True
Case "FZ"
rdb_frozen.Checked = True
Case "NA"
rdb_na.Checked = True
End Select
End Sub
At this point of time the label lbl_packed_as.Visible=false
so I can't reach the above method. If I set lbl_packed_as.Visible=True
then the above method is working. I don't want to show the lbl_packed_as
label on my screen.
Any help?
As I have said in comments, you could change the location of the Label to a point that is not inside the viewable area of your form.
I suggest to put your label, using the designer window, in a position where you could see it when you look at your form through the designer. Then, in code, move it to a different location. You could do this at the Form_Load event with this single line.
' Move the control to a position before the top and left border
' In this way it is not visible to the end user but still retains
' its visible property to allow databindings to function
lbl_packed_as.Location = new Point(-1000, -1000)