none
Event to fire when entering a tabpage or when changes in a DataGridView? RRS feed

  • Question

  • Hallo,

    I have tabcontrol page which contains a datagridview and it is bound to a bindingsource(datatable) and i have an additional column added just to the datagridview. 

    I have a sub which populates this additional column based on the value from an another column in the same datagridview. Now i want to fire this sub when user enter this specific tab page or before, whenever there is a change in dependent column.

    This datagridview is completely read only. I have tried "tabpage.enter" event but it fires only once when the user enters this tab for the first time. Any other options or idea?

    Thanks 

    Wednesday, October 9, 2019 6:38 AM

Answers

  • Hi Shan1986,

    I'm not sure if I can understand your situation.
    You can use "SelectedIndexChanged" event of TabControl.

    e.g.
    Private Sub TabControl1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TabControl1.SelectedIndexChanged
    	MsgBox("SelectedIndexChanged: page=" & Me.TabControl1.SelectedIndex)
    End Sub
    

    Regards,

    Ashidacchi -- https://ssl01.rocketnet.jp/hokusosha.com/default.html


    • Edited by Ashidacchi Wednesday, October 9, 2019 7:01 AM
    • Marked as answer by Shan1986 Thursday, October 10, 2019 7:46 PM
    Wednesday, October 9, 2019 6:59 AM

All replies

  • Hi Shan1986,

    I'm not sure if I can understand your situation.
    You can use "SelectedIndexChanged" event of TabControl.

    e.g.
    Private Sub TabControl1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TabControl1.SelectedIndexChanged
    	MsgBox("SelectedIndexChanged: page=" & Me.TabControl1.SelectedIndex)
    End Sub
    

    Regards,

    Ashidacchi -- https://ssl01.rocketnet.jp/hokusosha.com/default.html


    • Edited by Ashidacchi Wednesday, October 9, 2019 7:01 AM
    • Marked as answer by Shan1986 Thursday, October 10, 2019 7:46 PM
    Wednesday, October 9, 2019 6:59 AM
  • Look at the Form.Activated Event. Please excuse my senior brain, but I forget if the tabpage is also the form but if not then you will use the event for the form in the tabpage.


    Sam Hobbs
    SimpleSamples.Info

    Wednesday, October 9, 2019 8:23 PM
  • Hi Shan1986,

    I'm not sure if I can understand your situation.
    You can use "SelectedIndexChanged" event of TabControl.

    e.g.
    Private Sub TabControl1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TabControl1.SelectedIndexChanged
    	MsgBox("SelectedIndexChanged: page=" & Me.TabControl1.SelectedIndex)
    End Sub
    

    Regards,

    Ashidacchi -- https://ssl01.rocketnet.jp/hokusosha.com/default.html


    thanks
    Thursday, October 10, 2019 7:47 PM