Posted on 2006-05-10
Last Modified: 2007-12-19
I would like to create a button so that when you click it you see
this MessageBox.Show(GetVolumeSerialNumber("C:\"))
how can I do that ?
Question by:aplelois
    LVL 20

    Assisted Solution

    Do you mean you want a MessageBox to display when you click a button, or you want the text on the button itself to have the results of your function?  In either case, you'd put the code in the button's Click event, such as:

        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        End Sub


        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Button1.Text = GetVolumeSerialNumber("C:\")
        End Sub

    The click event subroutine is the one created when you double-click a button that's on the design surface of a form.

    Author Comment

    Error      1      Name 'GetVolumeSerialNumber' is not declared.
    LVL 9

    Accepted Solution

    I believe this is what you are looking for.
    LVL 20

    Expert Comment

    Perhaps I misunderstood. I thought from this and your other message that you already had the function created to get a volume serial number. If you don't have that function, then sk33v3's link is what you need; download the code from there. If you have the function in your program, and you're getting the error above, then I think you need to explain a bit more what's going on (show us the code where you're getting the error).

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    754 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

    26 Experts available now in Live!

    Get 1:1 Help Now