I am trying to set the combo box width during run time. If I set combobox1.width=60 in the form_load it works perfect. But If I loop through all controls in the form using for each statement, setting control.width for combobox fails and throws an error saying 'Parameter not Valid'. I have pasted the code below which is in a module. This routine is called in Form_load of every form.
Note: I am using VB.net 2008 Professional, windows 7 and 64 bit.
The same code works in another computer which has VB.net 2010 express edition, windows xp and 32 bit.
Code in Module is below.
Public Sub ControlSize(ByVal Controlname As Object, ByVal ControlTop As Integer, ByVal ControlLeft As Integer)
Control.width = Control.width * ML_scalefactor
Control.Height = Control.Height * ML_scalefactor
Control.top = Control.Top * ML_scalefactor
Control.left = Control.Left * ML_scalefactor
Debug.Print(Control.name & "," & Control.width & "," & Control.height & "," & Control.top & "," & Control.left)
Catch ex As Exception
Code in form_load to call the above routine:
Call ControlSize(Me, 200, 200)
2 มีนาคม 2555 11:52
- ย้ายโดย Terry WarwickMicrosoft 9 มีนาคม 2555 14:53 Wrong Forum (From:POS for .NET)