K
kpg
Hi all,
I have a vb.net class with this in it:
Public Sub SetValues(ByVal obj As Object)
DirectCast(obj, ComboBox).Items.Add("Value1")
DirectCast(obj, ComboBox).Items.Add("Value2")
End Sub
Problem: ComboBox is unrecognized becuase this is a class library, not a
form. So I add:
Imports System.Windows.Forms
and I get an error -
Warning 1 Namespace or type specified in the Imports
'System.Windows.Forms' doesn't contain any public member or cannot be
found. Make sure the namespace or the type is defined and contains at least
one public member. Make sure the imported element name doesn't use any
aliases.
Also adding this does not help (of course):
DirectCast(obj, System.Windows.Forms.ComboBox).Items.Add("Value1")
So how can I have a method that accepts a ComboBox object and manipulates
it?
Thanks,
kpg
I have a vb.net class with this in it:
Public Sub SetValues(ByVal obj As Object)
DirectCast(obj, ComboBox).Items.Add("Value1")
DirectCast(obj, ComboBox).Items.Add("Value2")
End Sub
Problem: ComboBox is unrecognized becuase this is a class library, not a
form. So I add:
Imports System.Windows.Forms
and I get an error -
Warning 1 Namespace or type specified in the Imports
'System.Windows.Forms' doesn't contain any public member or cannot be
found. Make sure the namespace or the type is defined and contains at least
one public member. Make sure the imported element name doesn't use any
aliases.
Also adding this does not help (of course):
DirectCast(obj, System.Windows.Forms.ComboBox).Items.Add("Value1")
So how can I have a method that accepts a ComboBox object and manipulates
it?
Thanks,
kpg