Working with controls in the multiple forms

Posted on 2006-04-25
Last Modified: 2010-04-17
hi good day how do i use contols on multiple forms?
Question by:hariprasadere
    LVL 65

    Expert Comment

    by:Jim Horn
    A control can only be located on a single form.   By any chance do you mean MDI forms?

    Author Comment

    ok it's not really MDI forms.I have two forms form a and form b .form a is an  items entry screen and form b is a category entry screen.In form a i have a command button where user can click and add category of the items.As soon as the user enter the data in the form b n close the form b,  the  cursor should foucs in the first textbox control of the form a .
    LVL 85

    Expert Comment

    by:Mike Tomlinson
    What language are you working in here?...

    Author Comment

    LVL 85

    Accepted Solution

    Show Form B using ShowDialog()...

    In Form A:  

        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim frmB As New FormB
            frmB.ShowDialog() ' code STOPS here until frmB is CLOSED

            ' grab something from frmB
            TextBox1.Text = frmB.TextBox1.Text

            ' give focus to TextBox1
        End Sub

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
    Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now