Ask a questionAsk a question
 

AnswerList pop-up

  • Friday, November 06, 2009 5:28 PMa.net sukbir Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Dear All,
                I want to run a program where it will always get a list of data from the backend database and on each refresh I want a list of data to be pop-up just like when some one sign in on msn messenger. But here once it referesh there will be list of data just like a table being pop-up with few column. I know how to get the data that is not a problem here. So another thing then once if I click any of the row then it should pop-up a window. Any help or example where I can follow pls. Thank you.

Answers

  • Saturday, November 07, 2009 8:57 AMBLIS Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code
    I use datagrid Wiews.  I use listbox to, but i cpoy past a lot so i uses datagrid.

    In this Url the documnetetion of datagrid views
    www.windowsclient.net/Samples/Go%20To%20Market/DataGridView/DataGridView%20FAQ.doc


    You ca use ADO, but i like to use sql calls directly to the datasource.

    Some code

    Steps:
     1 - Crete a win forms in Visual Studio 2008 - 10 , in 2005 you have to add some code.
     2 -  Drop a datgrid view into a form
     3 -  Create a format sub (Copy and paste form project to project and change properties.
     4 - Create a fill datagridview sub
     5 - Create a event by click on the DataGrid in the form and pick the event that supports your project.


     Private Sub MyDataGridViewName_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles MyDataGridViewName.CellClick
    
            'Use 
    
            'The user clics on a cell , explore other evetns to.
    
            Dim c = MyDataGridViewName.CurrentCell.ColumnIndex
    
            Dim R = MyDataGridViewName.CurrentCell.RowIndex
    
            Dim ContentsOfTheCell = MyDataGridViewName.Item(c, R)' Use the content of yourcell to show a new datagridview
    
            'Here you can start a program who populate and sho the Grid
    
     
    
     
    
    End sub
    
     
    
    Code used to format the grid.
    
    Public Class Form1
    
     
    
        Private Sub BuildMyDataGridViev()
    
            Dim ICreateSomeColumns = CInt(7)  
    
               You can get the columns name from the database tables to.
    
     
    
            With MyDataGridViewName 'Topp and ends in the bottumn
    
                'Formating my grid 
    
                Dim C = 0
    
                While C <= ICreateSomeColumns
    
     
    
                    Dim ColName = MyCollumnList(C)
    
                    .Columns.Add(ColName, ColName)
    
     
    
                End While
    
     
    
                'Formating my grid
    
                ' You can use prporty windows, but this you can copy paste.
    
                With .DefaultCellStyle
    
     
    
                End With
    
     
    
                With .ColumnHeadersDefaultCellStyle
    
     
    
                End With
    
     
    
                With .RowHeadersDefaultCellStyle
    
     
    
                End With
    
     
    
     
    
            End With
    
     
    
            'If someone 
    
     
    
     
    
        End Sub
    
     
    
     
    
     
    
     
    
        Private Function MyCollumnList(ByVal ColNumber As Integer) As String
    
            Dim ColName = ""
    
     
    
            If ColNumber = 0 Then
    
                ColName = "Car number one"
    
            ElseIf ColNumber = 1 Then
    
                ColName = "Collor car "
    
           ElseIf | ColNumber = 2 Then
    
                ColName = "Name car "
    
            ElseIf ColNumber = 3 Then
    
                ColName = "Driver "
    
            ElseIf ColNumber = 4 Then
    
                ColName = "Location "
    
            ElseIf ColNumber = 5 Then
    
                ColName = "Service "
    
            ElseIf ColNumber = 6 Then
    
                ColName = "SOP Discr. "
    
      
    
            End If
    
     
    
        End Function
    
    
    



    best regards :-)yvind



All Replies

  • Saturday, November 07, 2009 8:57 AMBLIS Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code
    I use datagrid Wiews.  I use listbox to, but i cpoy past a lot so i uses datagrid.

    In this Url the documnetetion of datagrid views
    www.windowsclient.net/Samples/Go%20To%20Market/DataGridView/DataGridView%20FAQ.doc


    You ca use ADO, but i like to use sql calls directly to the datasource.

    Some code

    Steps:
     1 - Crete a win forms in Visual Studio 2008 - 10 , in 2005 you have to add some code.
     2 -  Drop a datgrid view into a form
     3 -  Create a format sub (Copy and paste form project to project and change properties.
     4 - Create a fill datagridview sub
     5 - Create a event by click on the DataGrid in the form and pick the event that supports your project.


     Private Sub MyDataGridViewName_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles MyDataGridViewName.CellClick
    
            'Use 
    
            'The user clics on a cell , explore other evetns to.
    
            Dim c = MyDataGridViewName.CurrentCell.ColumnIndex
    
            Dim R = MyDataGridViewName.CurrentCell.RowIndex
    
            Dim ContentsOfTheCell = MyDataGridViewName.Item(c, R)' Use the content of yourcell to show a new datagridview
    
            'Here you can start a program who populate and sho the Grid
    
     
    
     
    
    End sub
    
     
    
    Code used to format the grid.
    
    Public Class Form1
    
     
    
        Private Sub BuildMyDataGridViev()
    
            Dim ICreateSomeColumns = CInt(7)  
    
               You can get the columns name from the database tables to.
    
     
    
            With MyDataGridViewName 'Topp and ends in the bottumn
    
                'Formating my grid 
    
                Dim C = 0
    
                While C <= ICreateSomeColumns
    
     
    
                    Dim ColName = MyCollumnList(C)
    
                    .Columns.Add(ColName, ColName)
    
     
    
                End While
    
     
    
                'Formating my grid
    
                ' You can use prporty windows, but this you can copy paste.
    
                With .DefaultCellStyle
    
     
    
                End With
    
     
    
                With .ColumnHeadersDefaultCellStyle
    
     
    
                End With
    
     
    
                With .RowHeadersDefaultCellStyle
    
     
    
                End With
    
     
    
     
    
            End With
    
     
    
            'If someone 
    
     
    
     
    
        End Sub
    
     
    
     
    
     
    
     
    
        Private Function MyCollumnList(ByVal ColNumber As Integer) As String
    
            Dim ColName = ""
    
     
    
            If ColNumber = 0 Then
    
                ColName = "Car number one"
    
            ElseIf ColNumber = 1 Then
    
                ColName = "Collor car "
    
           ElseIf | ColNumber = 2 Then
    
                ColName = "Name car "
    
            ElseIf ColNumber = 3 Then
    
                ColName = "Driver "
    
            ElseIf ColNumber = 4 Then
    
                ColName = "Location "
    
            ElseIf ColNumber = 5 Then
    
                ColName = "Service "
    
            ElseIf ColNumber = 6 Then
    
                ColName = "SOP Discr. "
    
      
    
            End If
    
     
    
        End Function
    
    
    



    best regards :-)yvind