perhaps the subject is not so explanatory but now I try to explain with an example that well represents my problem.
I have a UserControl with two NumericUpDown and a button, then I have a Form1 with a TabControl1 with just one page.
Loading the form I add some pages to the TabControl and I put in every page my UserControl (called "base") in this way:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim mypag As TabPage
Dim myuc As base
For i As Int32 = 0 To 10
mypag = New TabPage
myuc = New base
myuc.Parent = mypag
mypag.Text = "Pag" & i.ToString
mypag.Name = "Pag" & i.ToString
TabControl1.TabPages.Insert(1 + i, mypag)
Than with the button on the page of the TabControl I pass to the next page of the TabControl (and this is done) but I also want to put in the first NumericUpDown of the "next page" the sum of the value of the two NumericUpDown in the current page (the one with the button just pressed) and I don't know how to do this.
The code in the button is:
Public Class base
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim tmp, id As Int32
tmp = NUD1.Value + NUD2.Value
id = CType(Parent.Parent, TabControl).SelectedIndex
CType(Parent.Parent, TabControl).SelectedIndex += 1
I don't know how to "poit" to the NumericUpDown of a page different from the one in witch I am, even if I can get the index of that page (I think...)
I tryed something like this:
CType(Parent.Parent, TabControl).TabPages(id + 1)
CType(Parent.Parent, TabControl).TabPages(id + 1).NUD1.Value
Can someone give me some advice?
Thanks in advance
General News Suggestion Question Bug Answer Joke Praise Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.