Click here to Skip to main content
14,737,917 members
Home » Discussions » Visual Basic
   

Visual Basic

 
GeneralRe: how to display image from gridview on picturebox Pin
Wes Aday21-Apr-12 9:40
professionalWes Aday21-Apr-12 9:40 
QuestionSoap Envelope Response and Download Docs Pin
VBseasons20-Apr-12 21:53
MemberVBseasons20-Apr-12 21:53 
AnswerRe: Soap Envelope Response and Download Docs Pin
Eddy Vluggen21-Apr-12 0:54
professionalEddy Vluggen21-Apr-12 0:54 
QuestionHelp! Saving data from a datagridview to a local table in Visual Studio Pin
AnthonyDailyMail20-Apr-12 9:10
MemberAnthonyDailyMail20-Apr-12 9:10 
AnswerRe: Help! Saving data from a datagridview to a local table in Visual Studio Pin
Eddy Vluggen21-Apr-12 5:18
professionalEddy Vluggen21-Apr-12 5:18 
GeneralRe: Help! Saving data from a datagridview to a local table in Visual Studio Pin
AnthonyDailyMail23-Apr-12 4:40
MemberAnthonyDailyMail23-Apr-12 4:40 
AnswerRe: Help! Saving data from a datagridview to a local table in Visual Studio Pin
Eddy Vluggen23-Apr-12 9:03
professionalEddy Vluggen23-Apr-12 9:03 
GeneralRe: Help! Saving data from a datagridview to a local table in Visual Studio Pin
AnthonyDailyMail23-Apr-12 5:36
MemberAnthonyDailyMail23-Apr-12 5: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 885590420-Apr-12 0:00
MemberMember 885590420-Apr-12 0:00 
GeneralRe: Chat without server Pin
Dave Kreskowiak20-Apr-12 4:28
mveDave Kreskowiak20-Apr-12 4:28 
AnswerRe: Chat without server Pin
Eddy Vluggen21-Apr-12 5:20
professionalEddy Vluggen21-Apr-12 5:20 
GeneralRe: Chat without server Pin
Member 422308723-Apr-12 2:37
MemberMember 422308723-Apr-12 2:37 
QuestionVisual Basic.net Pin
Hermaine18-Apr-12 22:39
MemberHermaine18-Apr-12 22:39 
GeneralRe: Visual Basic.net Pin
Richard MacCutchan18-Apr-12 23:40
mveRichard MacCutchan18-Apr-12 23:40 
AnswerRe: Visual Basic.net Pin
Simon_Whale19-Apr-12 4:06
professionalSimon_Whale19-Apr-12 4:06 
AnswerRe: Visual Basic.net Pin
Dave Kreskowiak19-Apr-12 7:06
mveDave Kreskowiak19-Apr-12 7:06 
AnswerRe: Visual Basic.net Pin
Sentenryu20-Apr-12 2:35
MemberSentenryu20-Apr-12 2:35 
GeneralRe: Visual Basic.net Pin
Hermaine22-Apr-12 19:56
MemberHermaine22-Apr-12 19:56 
QuestionRegular Expressions: dealing with a quote Pin
Brad Fackrell18-Apr-12 4:43
MemberBrad Fackrell18-Apr-12 4:43 
AnswerRe: Regular Expressions: dealing with a quote Pin
Eddy Vluggen18-Apr-12 6:02
professionalEddy Vluggen18-Apr-12 6:02 
GeneralRe: Regular Expressions: dealing with a quote Pin
Brad Fackrell18-Apr-12 6:12
MemberBrad Fackrell18-Apr-12 6:12 
AnswerRe: Regular Expressions: dealing with a quote Pin
VJ Reddy18-Apr-12 6:08
MemberVJ Reddy18-Apr-12 6:08 
GeneralRe: Regular Expressions: dealing with a quote Pin
Brad Fackrell18-Apr-12 6:21
MemberBrad Fackrell18-Apr-12 6:21 
GeneralRe: Regular Expressions: dealing with a quote Pin
VJ Reddy18-Apr-12 6:45
MemberVJ Reddy18-Apr-12 6:45 
AnswerRe: Regular Expressions: dealing with a quote Pin
proneal26-Apr-12 10:44
Memberproneal26-Apr-12 10: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.