Results 1 to 13 of 13

Thread: [RESOLVED] Want to check all labels on form to see if Label name has certain string within it.

Threaded View

  1. #9

    Thread Starter
    Fanatic Member EntityX's Avatar
    Join Date
    Feb 2007
    Location
    Omnipresence
    Posts
    798

    Re: Want to check all labels on form to see if Label name has certain string within i

    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 :
    Code:
       st5 = Me.ActiveControl.Name
       st5 = st5.Replace("ComboBox", "")
    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.

    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.

    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 could make the second, third, etc. opening of the form respond like the first then I'd be ok.

    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.
    Last edited by EntityX; Dec 19th, 2009 at 12:56 PM.
    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.

    "Persistence is the magic of success." Paramahansa Yogananda

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width