Advertisement

11.22.2007 at 01:34AM PST, ID: 22977170
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.2

Calling VB.Net form from dynamically created buttons

Asked by mcdermon in Microsoft Visual Basic.Net, .NET, Visual Studio

Tags: , , ,

Hello,
   I have created a menu in VB.Net which creates several button dynamically. Each of these buttons opens the same form, but I would like to pass through a unique number depending on which button is chosen. At the minute my menu is created but only the last button opens the form - instead of all the buttons. Any ideas where I am going wrong???
Here is some relevant code:-

While sqlDtr.Read
               .
               .
               cmdButton = Me.MakeANewButton(toolBar, CStr(sqlDtr("Caption")), CInt(sqlDtr("Group")), CInt(sqlDtr("ParentId")), nextInt, AddressOf btnSearch_Click)
               .
               .
                nextInt = nextInt + 1
            End While
            sqlDtr.Close()

Function MakeANewButton(ByVal commandBar As Office.CommandBar, ByVal caption As String, ByVal GroupId As Integer, ByVal ParentID As Integer, ByVal faceID As Integer, ByVal clickHandler As Office._CommandBarButtonEvents_ClickEventHandler) As Office.CommandBarButton
        Try
            newButton = CType(commandBar.Controls.Add(Office.MsoControlType.msoControlButton), Office.CommandBarButton)
            newButton.Style = Office.MsoButtonStyle.msoButtonCaption
            newButton.Caption = caption
            newButton.FaceId = faceID
            AddHandler newButton.Click, clickHandler
            If Begin_Group = -1 Then
                Begin_Group = 0
                newButton.BeginGroup = True
            Else
                newButton.BeginGroup = False
            End If
            newButton.DescriptionText = CStr(GroupId)
            Return newButton
        Catch ex As System.Exception
            ' Add code here to handle the exception.
            MsgBox(ex.Message)
            Return Nothing
        End Try
    End Function

Private Sub btnSearch_Click(ByVal barButton As Office.CommandBarButton, ByRef someBool As Boolean)
        Try
            If Not IsNothing(frmFind) Then
                If Not frmFind.IsDisposed Then
                    frmFind.BringToFront()
                Else
                    frmFind = New frmSearch()
                End If
            Else
                frmFind = New frmSearch()
            End If
            frmFind.ShowDialog()

        Catch ex As Exception
            MsgBox(ex.Message)
        Finally
            frmFind = Nothing
        End Try
    End Sub

Thanks,
mcdermonStart Free Trial
[+][-]11.22.2007 at 01:41AM PST, ID: 20333468

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Visual Basic.Net, .NET, Visual Studio
Tags: created, dynamically, button, form
Sign Up Now!
Solution Provided By: armoghan
Participating Experts: 1
Solution Grade: B
 
 
[+][-]11.22.2007 at 01:46AM PST, ID: 20333481

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.22.2007 at 02:03AM PST, ID: 20333527

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.22.2007 at 02:20AM PST, ID: 20333576

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.22.2007 at 03:36AM PST, ID: 20333804

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.22.2007 at 04:07AM PST, ID: 20333950

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.22.2007 at 06:09AM PST, ID: 20334427

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.22.2007 at 06:53AM PST, ID: 20334602

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.26.2007 at 04:01AM PST, ID: 20349328

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.26.2007 at 06:29AM PST, ID: 20350000

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.26.2007 at 07:41AM PST, ID: 20350528

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.27.2007 at 06:06AM PST, ID: 20357893

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.27.2007 at 08:10AM PST, ID: 20358896

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.27.2007 at 08:29AM PST, ID: 20359065

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.27.2007 at 08:45AM PST, ID: 20359230

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.28.2007 at 02:26AM PST, ID: 20364400

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628