W
Woody Splawn
From a Winform I am calling the sub routine that follows in a module
Public Sub PopulateWithStates(ByVal myform As Contracts, ByVal FieldName As
String)
Select Case FieldName
Case "txtST"
myform.txtST.Items.Clear()
myform.txtST.Items.Add("CA")
myform.txtST.Items.Add("WA")
End Select
End Sub
This works but what I would really like to do is not have to write a case
statement with all the states for each field that has a different name. I
did it this way only because I knew it would work but I would really like to
pass the name of the field involved by value in the Sub routine definition
but I don't know how. Something like
Public Sub PopulateWithStates(ByVal myform As Contracts, ByVal FieldName As
FieldObject)
MyForm.FieldObject.Items.clear()
myForm.FieldObject.Add("CA") etc.....
Could someone advise me on how to do this?
Public Sub PopulateWithStates(ByVal myform As Contracts, ByVal FieldName As
String)
Select Case FieldName
Case "txtST"
myform.txtST.Items.Clear()
myform.txtST.Items.Add("CA")
myform.txtST.Items.Add("WA")
End Select
End Sub
This works but what I would really like to do is not have to write a case
statement with all the states for each field that has a different name. I
did it this way only because I knew it would work but I would really like to
pass the name of the field involved by value in the Sub routine definition
but I don't know how. Something like
Public Sub PopulateWithStates(ByVal myform As Contracts, ByVal FieldName As
FieldObject)
MyForm.FieldObject.Items.clear()
myForm.FieldObject.Add("CA") etc.....
Could someone advise me on how to do this?