2 Replies - 976 Views - Last Post: 21 August 2013 - 03:58 AM Rate Topic: -----

#1 pc20912  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 58
  • Joined: 14-April 13

Vb.Net - Tab Page Controls

Posted 17 August 2013 - 03:03 AM

Dim PathBTN As Button
Dim PathTxt As TextBox
Dim PathBTN2 As Button
Dim PathTxt2 As TextBox

Dim Odate As New TextBox
        Dim NewDate As DateTimePicker
        Dim PathBTN As Button
        Dim PathTxt As TextBox
        Dim PathBTN2 As Button
        Dim PathTxt2 As TextBox

        RecCount = DT.Rows.Count

        TabControl1.TabPages.Clear()

        If RecCount > 0 Then
            For Each DR In DT.Rows
                newPage = New TabPage

                newPage.Text = RecCount

                Odate = New TextBox
                NewDate = New DateTimePicker
                PathBTN = New Button
                PathTxt = New TextBox
                PathBTN2 = New Button
                PathTxt2 = New TextBox

                Odate = New TextBox
                Odate.Text = ""
                newPage.Controls.Add(Odate)

                NewDate = New DateTimePicker
                NewDate.Format = DateTimePickerFormat.Short
                newPage.Controls.Add(NewDate)
                newPage.Controls.Add(NewDate)

                PathBTN = New Button
                PathBTN.Text = "Browse"
	AddHandler PathBTN.Click, AddressOf NewClick1
              newPage.Controls.Add(PathBTN)

                PathTxt = New TextBox
                PathTxt.Text = ""
                newPage.Controls.Add(PathTxt)


                PathBTN2 = New Button
                PathBTN2.Text = "Browse"
AddHandler PathBTN2.Click, AddressOf NewClick2
                newPage.Controls.Add(PathBTN2)

                PathTxt2 = New TextBox
                PathTxt2.Text = ""
                newPage.Controls.Add(PathTxt2)

                RecCount += -1
                TabControl2.TabPages.Add(newPage)

            Next
        End If

Private Sub NewClick1 (ByVal sender As System.Object, ByVal e As System.EventArgs)
'Here I wrote OpenFileDialog1 codes



I created Tab Pages to equal of repeat times from this code,
Also add some more controls like this, (Repeat times mean number of rows on same ID)

Now I want do this

1. How I change "NewDate" (DateTimePicker) date on tabpage and then this shows in "Odate" (TextBox)


2. I did like this to FileOpen,
If I click PathBTN2 in order First then, File Name Show in Incorrect TextBox,How I Correct this


If Path1FileDIAG.ShowDialog() = DialogResult.OK Then
		TabControl2.SelectedTab.Controls(4).Text =Path1FileDIAG.FileName.ToString
	EndIf



If Path1FileDIAG.ShowDialog() = DialogResult.OK Then
		TabControl2.SelectedTab.Controls(6).Text =Path1FileDIAG.FileName.ToString
	EndIf



3. Is there any way to handle those control without control Number (Ex. Control Name)

TabControl1.SelectedTab.Controls(4).Text =

Please Help me do this,

Is This A Good Question/Topic? 0
  • +

Replies To: Vb.Net - Tab Page Controls

#2 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1030
  • View blog
  • Posts: 4,012
  • Joined: 02-July 08

Re: Vb.Net - Tab Page Controls

Posted 17 August 2013 - 08:14 AM

When you need a group of controls that have the same logic - you use a UserControl. Then all you have to do is add the to your tabpage and your done. You communicate from the UC to the form with Events, inside your UC you raise these events and the form subscribes to those and your UC's can pass data this way.

This post has been edited by _HAWK_: 17 August 2013 - 08:15 AM

Was This Post Helpful? 0
  • +
  • -

#3 pc20912  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 58
  • Joined: 14-April 13

Re: Vb.Net - Tab Page Controls

Posted 21 August 2013 - 03:58 AM

Thanks for reply,

Sir, I am beginner for VB.Net(Sorry for my English) , I can't really understand what you mean,
If You can please explain one by one my questions. My big question is
TabControl1.SelectedTab.Controls(4)
How to do this without controls (number) - (I want with control name)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1