2uzhan.com
Advertisement
Now Place:2uzhan.com » Using Command button to go to next tab

Using Command button to go to next tab

Software Development @ April 21, 2009   Views:0

Hello all,
I have a form of 4 tabcontrol, I want to put the next button on each tab so that when the user press it, it goes to the next tab.
How will i do that.
Please, help me out.

--------------Solutions-------------

Use tab control's SelectedIndex property to change tab page. Here's a simple sample snippet

Public Class Form2

  Private m_CurrentIndex As Integer

  Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    '
    m_CurrentIndex = 0 ' Start with first tab

  End Sub

  Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    '
    ' Increase index
    m_CurrentIndex += 1
    ' Check that index is in the bounds
    If m_CurrentIndex >= 0 AndAlso m_CurrentIndex < TabControl1.TabCount Then
      ' Show next tab page
      TabControl1.SelectedIndex = m_CurrentIndex
    End If

  End Sub

End Class

To test it, drop a tab control on a form and put a button control in the first tab page. Notice that you may have to change control names in the code above.

HTH

private void btnNext_Click(object sender, EventArgs e)
        {
            tabControl1.SelectedIndex = tabControl1.TabIndex + 1;

        }
int currenttab = 0;
        private void Next_Click(object sender, EventArgs e)
        {
                currenttab = tabControl1.SelectedIndex;
                currenttab = currenttab + 1;
            if (currenttab < tabControl1.TabCount)
            {
                tabControl1.SelectedIndex = currenttab;

            }

        }
private void Back_Click(object sender, EventArgs e)
        {
             currenttab = tabControl1.SelectedIndex;
             currenttab = currenttab - 1;
            if (currenttab >-1 )
            {
                tabControl1.SelectedIndex = currenttab;

            }

        }

I'm attempting to simplify my fundraising page, and would like to show exactly how much each donation would help us out. I've listed the options below, but I would like ...

Write a java program that asks a person for his height (in meters) and weight (in kilograms) and
outputs one of the messages: underweight, normal, or obese, using the BMI ...

Before I get into the specific issues, I want to provide some other details:

  • Normally, I work on a live, paid server (even in dev); I realize that is ...
Tags:vb.net
© 2018 2uzhan.com Contact