OK. I tried deleting both the bin and obj(has debug folder in it) folders and did a rebuild and the problem is still there.
On a particular first trial the string st5 = "Dph". I open the form with all the labels and it goes to LabelDph just like it should. I close the form and click in a different combobox ComboBoxBph. st5 = "Bph" now since I use :
I reopen the form with all the labels and it still goes to LabelDph and not LabelBph which is way above it on the Form.Code:st5 = Me.ActiveControl.Name st5 = st5.Replace("ComboBox", "")
I used st6 to see what ctrl.Name is and it's LabelDph in the first case and LabelBph in the second case even though the form is opening at the LabelDph position in both cases.
If I could make the second, third, etc. opening of the form respond like the first then I'd be ok.Code:For Each ctrl In Me.Controls ctrl.Focus() If ctrl.Name.Contains(st5) Then st6 = ctrl.Name Exit For End If Next
If I click in ComboBoxBph first and then open the form with all the labels then it will open at LabelBph. If I then closed the form clicked in ComboBoxDph and then opened the form it would open at LabelBph again. It always gets the first opening of the form right and it always keeps the same position at all openings of the form after that until I close my application and start it up again.




Make as many mistakes as you can as quickly as you can. We want to make sure that we make a great enough number of mistakes in a given amount of time so that we can be successful.
Reply With Quote