I have a custom VB.NET control that I created that is working correctly in one program but not in another. The control has one button and one form. The form displays some data based on the settings in the control.
This is the use in both test projects:
With Me.MyControl1
'.Connection = gConn
.Server = "servername"
.DBName = "dbname"
.TableName = "table"
.FieldString = "list of fields"
.ReturnColumn = 0
.AllowMultiSelect = True
End With
This is how I am passing the settings to my form.
…this form is a part of the control
Public Sub New(ByVal cmsl As MyCustomControl)
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Me.Connection = cmsl.Connection
Me.ConnectionString = cmsl.ConnectionString
Me.Server = cmsl.Server
Me.DBname = cmsl.DBName
Me.TableName = cmsl.TableName
Me.FieldString = cmsl.FieldString
Me.FilterString = cmsl.FilterString
Me.AllowMultiSelect = cmsl.AllowMultiSelect
Me.AutoPopulate = cmsl.AutoPopulate
Me.ReturnColumn = cmsl.ReturnColumn
Me.SelectTop = cmsl.SelectTop
End Sub
In TestProject1 – the control is working as expected
In TestProject2 – the control is not sending any of the settings I set to the form
My control works fine when I debug with the UserControl TestContainer.
I am using VB.NET on VS2005.
This is all done on the same machine. Why would this work in one project and not another?
Seems like a reference error. please show us how the UserControl is integrated. The problem must come from there.
And are you talking about a custom control, or a UserControl ? (Not the same thing for me)
Try some breakpoints in the props, and also, try checking the references :). You might be working with a second usercontrol overlapping on the first one or something like that :).
In winforms the Designer sometimes goes weird.