Results 1 to 9 of 9

Thread: customizing message box

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2011
    Posts
    45

    Unhappy customizing message box

    i have two form
    in one form i salect some thing and click on done button a mesage box prompt me that u selcet this and this

    and on the other form a button result is place.. when i click on it a new form appears and the msg box text that appears on msg box appears in label which is on 3rd form... now what i do .. its not run first i do simple coading but i think its nt rgt

    for first form
    vb Code:
    1. Dim p As Integer
    2. Private Sub Command1_Click()
    3. p = MsgBox("thanku your text box value is" & vbCr & Text1.Text)
    4. End Sub  
    5.  
    6. form 3rd form
    7. Dim p As String
    8. Private Sub Form_Load()
    9. Label1.Caption = Form1.p
    10. End Sub


    its say method and data member not found its means all code is wrong what i do now... plzzz telll me
    Last edited by Hack; Oct 30th, 2011 at 07:15 AM. Reason: Added Highlight Tags

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: customizing message box

    Moved From the Codebank (which is for sharing code rather than posting questions

  3. #3
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: customizing message box

    On Form1.

    Not: Dim p As Integer
    But: Public p As Integer
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #4

    Thread Starter
    Member
    Join Date
    Sep 2011
    Posts
    45

    Re: customizing message box

    ok iwill do this but
    for form 1
    Public p As Integer
    Private Sub Command1_Click()
    p = MsgBox("thanku your text box value is" & vbCr & Text1.Text)

    for form 3
    Public p As Integer
    Private Sub Form_Load()
    Label1.Caption = Form1.p
    End Sub


    End Sub

    Private Sub Command2_Click()
    Form2.Show
    Form1.Hide
    End Sub

    it run accuratly but not give the rgt output just give 1 in label i tried many time with diffrnt ways but.. now what i do... why it gives 1

  5. #5
    Computer Science BS Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,339

    Re: customizing message box

    No you create a module and up in the general declarations put Public p as Integer, not in every form. Doing it in the module will allow that variable p to be accessible in all forms and modules with just one line of code. So you will no longer need the Form1.p. Just p

  6. #6
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: customizing message box

    I've answered a question like this recently. See if this thread helps
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  7. #7

    Thread Starter
    Member
    Join Date
    Sep 2011
    Posts
    45

    Re: customizing message box

    ya i have alredy do this and this time its give 0 in out put.... thats nt rgt ...

  8. #8

    Thread Starter
    Member
    Join Date
    Sep 2011
    Posts
    45

    Re: customizing message box

    LaVolpe... i don't understand that thread

  9. #9
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: customizing message box

    Quote Originally Posted by Misbah View Post
    LaVolpe... i don't understand that thread
    Spend some time trying to understand it or search the forums for other examples of custom message boxes.

    Your custom message box should do the following

    1. When shown, stop the calling line of code so it waits for the message box to close
    2. When the message box closes, it's result must be available to the line of code that called it

    The other thread I linked to does that

    1. When the custom msgbox form is shown, it makes itself modal. This prevents the calling code from continuing. It also makes the message box form wait until one of its buttons is clicked.

    2. Whenever one of the buttons on the form is clicked, it sets a value to the m_Result variable and unloads the form. This action allows the custom message box to return the value to the calling code. The calling code now continues
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

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