ajit.nayak 0 Newbie Poster

Dear all,

Here i have attached form window.I wanted to update form with relative data How to refresh the single form.

When New project detail is clicked from loaded with project data , when panel button clicked form loaded with panel data.

1)I tried this method. I created a group box for indivual button ,Show & hide when particular button being pressed. for example below . When new button pressed only display groupBox_new, Or any other method available.

Private Sub Button_New_Click(sender As Object, e As EventArgs) Handles Button_New.Click

   GroupBox_New.Show()
   GroupBox_Panel.Hide()
   GroupBox_inverter.hide()
 so  on.......

    End Sub

2) If you have checked my form i created groupbox called groupbox review. I want to update as soon as data entered in project data. I pasted my full code below. I found data is not refreshed but when choose next button and come to new option again it got populated. How can i make populate instantly.

My code look like this.

Public Class Form1

    Dim counter As Integer

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'ProjectDataSet.Project_Table' table. You can move, or remove it, as needed.
        Me.Project_TableTableAdapter.Fill(Me.ProjectDataSet.Project_Table)
        Static counter = 0
    End Sub

    Private Sub NewProjectToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles NewProjectToolStripMenuItem.Click

    End Sub


    Private Sub Button_pre_Click(sender As Object, e As EventArgs) Handles Button_pre.Click

        counter = counter - 1
        If counter = 0 Then
            Home_function()


        End If
        If counter = -1 Then
            Home_function()
            GroupBox_Project_Navigation.Refresh()
        End If
        If counter = 1 Then
            Home_function()
            GroupBox_Project_Navigation.Refresh()
        End If
        If counter = 2 Then
            New_function()
            Project_GropData()
        End If
        If counter = 3 Then
            SysType_function()

        End If

        If counter = 4 Then
            Panel_function()
        End If

        If counter = 5 Then
            Inverter_function()
        End If

        If counter = 6 Then
            Cable_function()
        End If

        If counter = 7 Then
            CktDiag_function()
        End If

        If counter = 8 Then
            BusBar_function()
        End If
        If counter = 9 Then
            Battery_function()
        End If
        If counter = 10 Then
            Calculate_function()
        End If
        If counter = 11 Then
            Curves_function()
        End If

        If counter > 11 Then
            counter = 0
        End If

    End Sub

    Private Sub Button_next_Click(sender As Object, e As EventArgs) Handles Button_next.Click

        counter = counter + 1
        If counter = 1 Then
            Home_function()
        End If
        If counter = 2 Then
            New_function()
        End If

        If counter = 3 Then
            SysType_function()
        End If
        If counter = 4 Then
            Panel_function()
        End If

        If counter = 5 Then
            Inverter_function()
        End If
        If counter = 6 Then
            Cable_function()
        End If

        If counter = 7 Then
            CktDiag_function()
        End If

        If counter = 8 Then
            BusBar_function()
        End If
        If counter = 9 Then
            Battery_function()
        End If
        If counter = 10 Then
            Calculate_function()
        End If
        If counter = 11 Then
            Curves_function()
        End If

        If counter > 11 Then
            counter = 0
        End If



    End Sub


    Private Function Cable_function()

        Button_Home.ForeColor = Color.Black
        Button_New.ForeColor = Color.Black
        Button_Systype.ForeColor = Color.Black
        Button_Panel.ForeColor = Color.Black
        Button_Inverter.ForeColor = Color.Black
        Button_Cable.ForeColor = Color.Blue
        Button_Ckt.ForeColor = Color.Black
        Button_Busbar.ForeColor = Color.Black
        Button_battery.ForeColor = Color.Black
        Button_Calc.ForeColor = Color.Black
        Button_Curves.ForeColor = Color.Black

        Return (0)
    End Function




    Private Function Project_GropData()
        GroupBox_Project_Navigation.Show()
        GroupBox_Project_Overview.Show()
        TextBox_Project_Name.Text = Project_NumberTextBox.Text
        TextBox_Proj_Designer.Text = Project_DesignerTextBox.Text
        TextBox_Project_no.Text = Project_NumberTextBox.Text
        Text_Start_Date.Text = Start_operationDateTimePicker.Text



        Return (0)
    End Function




    Private Function Home_function()

        Button_Home.ForeColor = Color.Blue
        Button_New.ForeColor = Color.Black
        Button_Systype.ForeColor = Color.Black
        Button_Panel.ForeColor = Color.Black
        Button_Inverter.ForeColor = Color.Black
        Button_Cable.ForeColor = Color.Black
        Button_Ckt.ForeColor = Color.Black
        Button_Busbar.ForeColor = Color.Black
        Button_battery.ForeColor = Color.Black
        Button_Calc.ForeColor = Color.Black
        Button_Curves.ForeColor = Color.Black

        Return (0)
    End Function

    Private Function New_function()
        Button_Home.ForeColor = Color.Black
        Button_New.ForeColor = Color.Blue
        Button_Systype.ForeColor = Color.Black
        Button_Panel.ForeColor = Color.Black
        Button_Inverter.ForeColor = Color.Black
        Button_Cable.ForeColor = Color.Black
        Button_Ckt.ForeColor = Color.Black
        Button_Busbar.ForeColor = Color.Black
        Button_battery.ForeColor = Color.Black
        Button_Calc.ForeColor = Color.Black
        Button_Curves.ForeColor = Color.Black

        GroupBox_New.Show()


        Return (0)
    End Function

    Private Function SysType_function()
        Button_Home.ForeColor = Color.Black
        Button_New.ForeColor = Color.Black
        Button_Systype.ForeColor = Color.Blue
        Button_Panel.ForeColor = Color.Black
        Button_Inverter.ForeColor = Color.Black
        Button_Cable.ForeColor = Color.Black
        Button_Ckt.ForeColor = Color.Black
        Button_Busbar.ForeColor = Color.Black
        Button_battery.ForeColor = Color.Black
        Button_Calc.ForeColor = Color.Black
        Button_Curves.ForeColor = Color.Black

        GroupBox_New.Hide()



        Return (0)
    End Function


    Private Function Panel_function()

        Button_Home.ForeColor = Color.Black
        Button_New.ForeColor = Color.Black
        Button_Systype.ForeColor = Color.Black
        Button_Panel.ForeColor = Color.Blue
        Button_Inverter.ForeColor = Color.Black
        Button_Cable.ForeColor = Color.Black
        Button_Ckt.ForeColor = Color.Black
        Button_Busbar.ForeColor = Color.Black
        Button_battery.ForeColor = Color.Black
        Button_Calc.ForeColor = Color.Black
        Button_Curves.ForeColor = Color.Black

        Return (0)
    End Function

    Private Function Inverter_function()

        Button_Home.ForeColor = Color.Black
        Button_New.ForeColor = Color.Black
        Button_Systype.ForeColor = Color.Black
        Button_Panel.ForeColor = Color.Black
        Button_Inverter.ForeColor = Color.Blue
        Button_Cable.ForeColor = Color.Black
        Button_Ckt.ForeColor = Color.Black
        Button_Busbar.ForeColor = Color.Black
        Button_battery.ForeColor = Color.Black
        Button_Calc.ForeColor = Color.Black
        Button_Curves.ForeColor = Color.Black

        Return (0)
    End Function


    Private Function CktDiag_function()

        Button_Home.ForeColor = Color.Black
        Button_New.ForeColor = Color.Black
        Button_Systype.ForeColor = Color.Black
        Button_Panel.ForeColor = Color.Black
        Button_Inverter.ForeColor = Color.Black
        Button_Cable.ForeColor = Color.Black

        Button_Ckt.ForeColor = Color.Blue
        Button_Busbar.ForeColor = Color.Black
        Button_battery.ForeColor = Color.Black
        Button_Calc.ForeColor = Color.Black
        Button_Curves.ForeColor = Color.Black

        Return (0)
    End Function


    Private Function BusBar_function()
        Button_Home.ForeColor = Color.Black
        Button_New.ForeColor = Color.Black
        Button_Systype.ForeColor = Color.Black
        Button_Panel.ForeColor = Color.Black
        Button_Inverter.ForeColor = Color.Black
        Button_Cable.ForeColor = Color.Black
        Button_Ckt.ForeColor = Color.Black
        Button_Busbar.ForeColor = Color.Blue
        Button_battery.ForeColor = Color.Black
        Button_Calc.ForeColor = Color.Black
        Button_Curves.ForeColor = Color.Black

        Return (0)
    End Function

    Private Function Battery_function()
        Button_Home.ForeColor = Color.Black
        Button_New.ForeColor = Color.Black
        Button_Systype.ForeColor = Color.Black
        Button_Panel.ForeColor = Color.Black
        Button_Inverter.ForeColor = Color.Black
        Button_Cable.ForeColor = Color.Black
        Button_Ckt.ForeColor = Color.Black
        Button_Busbar.ForeColor = Color.Black
        Button_battery.ForeColor = Color.Blue
        Button_Calc.ForeColor = Color.Black
        Button_Curves.ForeColor = Color.Black

        Return (0)
    End Function

    Private Function Calculate_function()

        Button_Home.ForeColor = Color.Black
        Button_New.ForeColor = Color.Black
        Button_Systype.ForeColor = Color.Black
        Button_Panel.ForeColor = Color.Black
        Button_Inverter.ForeColor = Color.Black
        Button_Cable.ForeColor = Color.Black
        Button_Ckt.ForeColor = Color.Black
        Button_Busbar.ForeColor = Color.Black
        Button_battery.ForeColor = Color.Black
        Button_Calc.ForeColor = Color.Blue
        Button_Curves.ForeColor = Color.Black

        Return (0)
    End Function

    Private Function Curves_function()
        Button_Home.ForeColor = Color.Black
        Button_New.ForeColor = Color.Black
        Button_Systype.ForeColor = Color.Black
        Button_Panel.ForeColor = Color.Black
        Button_Inverter.ForeColor = Color.Black
        Button_Cable.ForeColor = Color.Black
        Button_Ckt.ForeColor = Color.Black
        Button_Busbar.ForeColor = Color.Black
        Button_battery.ForeColor = Color.Black
        Button_Calc.ForeColor = Color.Black
        Button_Curves.ForeColor = Color.Blue

        Return (0)
    End Function




    Private Sub Project_TableBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles Project_TableBindingNavigatorSaveItem.Click

        Try
            Me.Validate()
            Me.Project_TableBindingSource.EndEdit()
            Me.TableAdapterManager.UpdateAll(Me.ProjectDataSet)
            MessageBox.Show("Data saved ")
            GroupBox_Project_Navigation.Refresh()

        Catch ex As Exception
            MessageBox.Show("Error  while download  ")
        End Try




    End Sub





End Class

mainwindow.jpg
My code look like this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.