Click here to Skip to main content
15,887,027 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: how to display image from gridview on picturebox Pin
Wes Aday21-Apr-12 8:40
professionalWes Aday21-Apr-12 8:40 
QuestionSoap Envelope Response and Download Docs Pin
VBseasons20-Apr-12 20:53
VBseasons20-Apr-12 20:53 
AnswerRe: Soap Envelope Response and Download Docs Pin
Eddy Vluggen20-Apr-12 23:54
professionalEddy Vluggen20-Apr-12 23:54 
QuestionHelp! Saving data from a datagridview to a local table in Visual Studio Pin
AnthonyDailyMail20-Apr-12 8:10
AnthonyDailyMail20-Apr-12 8:10 
AnswerRe: Help! Saving data from a datagridview to a local table in Visual Studio Pin
Eddy Vluggen21-Apr-12 4:18
professionalEddy Vluggen21-Apr-12 4:18 
GeneralRe: Help! Saving data from a datagridview to a local table in Visual Studio Pin
AnthonyDailyMail23-Apr-12 3:40
AnthonyDailyMail23-Apr-12 3:40 
AnswerRe: Help! Saving data from a datagridview to a local table in Visual Studio Pin
Eddy Vluggen23-Apr-12 8:03
professionalEddy Vluggen23-Apr-12 8:03 
GeneralRe: Help! Saving data from a datagridview to a local table in Visual Studio Pin
AnthonyDailyMail23-Apr-12 4:36
AnthonyDailyMail23-Apr-12 4:36 
Hey everyone, I'm taking a different approach. Below is the code I'm using to save data from an unbound datagridview to a table using VB. The unbound datagridview control is called "DataGridView1". The bound datagridview control is called "MyImporterDataGridView". This grid is bound to a table called "MyImporter". Everything seems to work. When I click the button it imports a text file into the unbound datagridview control called "DataGridView1 and then the second datagridview control called MyImporterDataGridView which is bound to the table is filled with the data from the unbound grid which suggest to me that the table is being filled with the data. Problem is when I close the form and go to the table to view the data it's empty. What am I doing wrong here? Frown | :(

If IsDBNull(Me.FileData.Text) Or Len(Me.FileData.Text) < 1 Then
            MsgBox("You must select the reformatter flate file", MsgBoxStyle.Information)
            Exit Sub
        Else
            Using MyReader As New  _
              Microsoft.VisualBasic.FileIO.TextFieldParser(Me.FileData.Text)
                MyReader.TextFieldType = FileIO.FieldType.Delimited
                MyReader.SetDelimiters(",")
                Dim currentRow As String()
                While Not MyReader.EndOfData
                    Try
                        currentRow = MyReader.ReadFields()
                        DataGridView1.Rows.Add(currentRow)
                    Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
                        MsgBox("Line " & ex.Message & _
                        "is not valid and will be skipped.")
                    End Try
                End While
            End Using
            'FlatFileImportDataGridView.DataSource = FlatFileImportBindingSource
            Dim dr As New System.Windows.Forms.DataGridViewRow
            'For Each dr In Me.FlatFileImportDataGridView.SelectedRows
            'Me.DataGridView2.Rows.Add(dr.Cells(0).Value, dr.Cells(1).Value, dr.Cells(2).Value, dr.Cells(3).Value, dr.Cells(4).Value, dr.Cells(5).Value, dr.Cells(6).Value, dr.Cells(7).Value)
            'Next
            Dim workrow As DataRow
            Dim i As Integer
            For i = 0 To DataGridView1.Rows.Count - 2
                workrow = Database1DataSet.Tables("MyImporter").NewRow()
                workrow(0) = DataGridView1.Rows(i).Cells(0).Value 'if the table field is a string
                workrow(1) = Val(DataGridView1.Rows(i).Cells(1).Value) 'if the table field is a number
                'workrow(2) = Val(DataGridView1.Rows(i).Cells(2).Value) 'if the table field is a number
                'workrow(3) = Val(DataGridView1.Rows(i).Cells(3).Value) 'if the table field is a number
                'workrow(4) = Val(DataGridView1.Rows(i).Cells(4).Value) 'if the table field is a number
                Database1DataSet.Tables("MyImporter").Rows.Add(workrow)
            Next

            TableAdapterManager.UpdateAll(Database1DataSet)
            
        End If

GeneralChat without server Pin
Member 885590419-Apr-12 23:00
Member 885590419-Apr-12 23:00 
GeneralRe: Chat without server Pin
Dave Kreskowiak20-Apr-12 3:28
mveDave Kreskowiak20-Apr-12 3:28 
AnswerRe: Chat without server Pin
Eddy Vluggen21-Apr-12 4:20
professionalEddy Vluggen21-Apr-12 4:20 
GeneralRe: Chat without server Pin
Member 422308723-Apr-12 1:37
Member 422308723-Apr-12 1:37 
QuestionVisual Basic.net Pin
Hermaine18-Apr-12 21:39
Hermaine18-Apr-12 21:39 
GeneralRe: Visual Basic.net Pin
Richard MacCutchan18-Apr-12 22:40
mveRichard MacCutchan18-Apr-12 22:40 
AnswerRe: Visual Basic.net Pin
Simon_Whale19-Apr-12 3:06
Simon_Whale19-Apr-12 3:06 
AnswerRe: Visual Basic.net Pin
Dave Kreskowiak19-Apr-12 6:06
mveDave Kreskowiak19-Apr-12 6:06 
AnswerRe: Visual Basic.net Pin
Sentenryu20-Apr-12 1:35
Sentenryu20-Apr-12 1:35 
GeneralRe: Visual Basic.net Pin
Hermaine22-Apr-12 18:56
Hermaine22-Apr-12 18:56 
QuestionRegular Expressions: dealing with a quote Pin
Brad Fackrell18-Apr-12 3:43
Brad Fackrell18-Apr-12 3:43 
AnswerRe: Regular Expressions: dealing with a quote Pin
Eddy Vluggen18-Apr-12 5:02
professionalEddy Vluggen18-Apr-12 5:02 
GeneralRe: Regular Expressions: dealing with a quote Pin
Brad Fackrell18-Apr-12 5:12
Brad Fackrell18-Apr-12 5:12 
AnswerRe: Regular Expressions: dealing with a quote Pin
VJ Reddy18-Apr-12 5:08
VJ Reddy18-Apr-12 5:08 
GeneralRe: Regular Expressions: dealing with a quote Pin
Brad Fackrell18-Apr-12 5:21
Brad Fackrell18-Apr-12 5:21 
GeneralRe: Regular Expressions: dealing with a quote Pin
VJ Reddy18-Apr-12 5:45
VJ Reddy18-Apr-12 5:45 
AnswerRe: Regular Expressions: dealing with a quote Pin
proneal26-Apr-12 9:44
proneal26-Apr-12 9:44 

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.