Click here to Skip to main content
15,896,118 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: How Font is related to Character set Pin
sunil goyalG15-Apr-09 3:00
sunil goyalG15-Apr-09 3:00 
GeneralRe: How Font is related to Character set Pin
Andy Missico18-Apr-09 18:49
Andy Missico18-Apr-09 18:49 
QuestionVisual Basic script error Pin
subramanyeswari15-Apr-09 1:02
subramanyeswari15-Apr-09 1:02 
AnswerRe: Visual Basic script error Pin
Andy Missico15-Apr-09 1:57
Andy Missico15-Apr-09 1:57 
AnswerRe: Visual Basic script error Pin
0x3c015-Apr-09 1:58
0x3c015-Apr-09 1:58 
QuestionOleDB Data Adaptor Problem Pin
specialdreamsin15-Apr-09 0:08
specialdreamsin15-Apr-09 0:08 
AnswerRe: OleDB Data Adaptor Problem Pin
Dave Kreskowiak15-Apr-09 2:25
mveDave Kreskowiak15-Apr-09 2:25 
Questionrefresh datagrid on another windows form Pin
sohaib_a14-Apr-09 21:36
sohaib_a14-Apr-09 21:36 
I have two forms in my application.On form1 there is datagridview -dg1 which is filled with a dataset-ds1.

On form2 I have a some code ,which after fulfilling certain conditions updates the database table which is contained in ds1.
When this is done I want to refresh datagridview-dg1 and show the updated table.
Both the forms are already open and I have to update them.



Form2

Public Event refreshdg1(ByVal st As String)

Private Sub

.......Some condition -->True then
....... Update database table

'I tried three ways here


1-    Raiseevent refreshdg1(s1)


2- 

        Dim StrCon As String
        Dim conn As SqlConnection
        StrCon = ConfigurationManager.AppSettings("StrCon")
        conn = New SqlConnection(StrCon)
        conn.Open()
       Dim ds As New SqlDataAdapter("Select * from Tag_History where Tag_ID = '" + s1 + "' ", conn)
      Dim commandBuilder As New SqlCommandBuilder(listadapter)

      Dim table As New DataTable()

      table.Locale = System.Globalization.CultureInfo.InvariantCulture
     listadapter.Fill(table)

     Form1.dg1.DataSource = table
     conn.Close()


3-   Form1.refreshdg(s1)


End sub



Form1:

Addhandler Form2.(I cant refreshdg1 here)


  Private Sub refreshdg(ByVal s As String)
        Dim f As New Parking_control
        AddHandler f.refreshdg1, AddressOf refreshdg
        Dim StrCon As String
        Dim conn As SqlConnection
        StrCon = ConfigurationManager.AppSettings("StrCon")
        conn = New SqlConnection(StrCon)
        conn.Open()
        
        Dim person As String
        person = s

        Dim ds1 As New SqlDataAdapter("Select * from Tag_History where Name = '" + person + "' ", conn)
        Dim commandBuilder As New SqlCommandBuilder(ds1)


        Dim table As New DataTable()

        table.Locale = System.Globalization.CultureInfo.InvariantCulture
        listadapter1.Fill(table)
        table.Columns(0).ColumnName = "Tag ID"
        table.Columns(1).ColumnName = "Date   Time"
        table.Columns(3).ColumnName = "Tag Status"
        dg1.DataSource = table
  
        conn.Close()

    End Sub

AnswerRe: refresh datagrid on another windows form Pin
Anubhava Dimri14-Apr-09 21:45
Anubhava Dimri14-Apr-09 21:45 
GeneralRe: refresh datagrid on another windows form Pin
sohaib_a14-Apr-09 22:09
sohaib_a14-Apr-09 22:09 
GeneralRe: refresh datagrid on another windows form Pin
Christian Graus14-Apr-09 22:12
protectorChristian Graus14-Apr-09 22:12 
AnswerRe: refresh datagrid on another windows form Pin
Christian Graus14-Apr-09 22:07
protectorChristian Graus14-Apr-09 22:07 
RantRe: refresh datagrid on another windows form Pin
Andy Missico15-Apr-09 0:15
Andy Missico15-Apr-09 0:15 
AnswerRe: refresh datagrid on another windows form Pin
Andy Missico15-Apr-09 0:12
Andy Missico15-Apr-09 0:12 
GeneralRe: refresh datagrid on another windows form Pin
sohaib_a16-Apr-09 8:45
sohaib_a16-Apr-09 8:45 
Questionhow to control 2 frames by 2 option buttons? Pin
zhiyuan1614-Apr-09 20:38
zhiyuan1614-Apr-09 20:38 
AnswerRe: how to control 2 frames by 2 option buttons? Pin
Guffa14-Apr-09 20:58
Guffa14-Apr-09 20:58 
AnswerRe: how to control 2 frames by 2 option buttons? Pin
Christian Graus14-Apr-09 22:08
protectorChristian Graus14-Apr-09 22:08 
AnswerRe: how to control 2 frames by 2 option buttons? Pin
Dalek Dave14-Apr-09 22:17
professionalDalek Dave14-Apr-09 22:17 
QuestionTwo way Data synchronization mssql 2008 express Pin
r_mohd14-Apr-09 20:01
r_mohd14-Apr-09 20:01 
AnswerRe: Two way Data synchronization mssql 2008 express Pin
Ashfield14-Apr-09 21:07
Ashfield14-Apr-09 21:07 
QuestionAppActivate and Send Keys not working correctly Pin
CARisk314-Apr-09 12:29
CARisk314-Apr-09 12:29 
AnswerRe: AppActivate and Send Keys not working correctly Pin
Dave Kreskowiak15-Apr-09 2:23
mveDave Kreskowiak15-Apr-09 2:23 
GeneralRe: AppActivate and Send Keys not working correctly Pin
CARisk315-Apr-09 3:27
CARisk315-Apr-09 3:27 
GeneralFind some code but not understanding it Pin
CARisk315-Apr-09 8:26
CARisk315-Apr-09 8:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.