Click here to Skip to main content
15,904,348 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionHow do I make a button to save combobox theme? Pin
Member 1289787210-Dec-16 14:32
Member 1289787210-Dec-16 14:32 
AnswerRe: How do I make a button to save combobox theme? Pin
Richard MacCutchan10-Dec-16 20:50
mveRichard MacCutchan10-Dec-16 20:50 
QuestionLoading a combobox from the selection of a previous combobox in visual basic Pin
CharlesGuru8-Dec-16 22:41
CharlesGuru8-Dec-16 22:41 
AnswerRe: Loading a combobox from the selection of a previous combobox in visual basic Pin
Richard MacCutchan8-Dec-16 23:01
mveRichard MacCutchan8-Dec-16 23:01 
QuestionDownload Web page (aspx) with content / Webclient? Pin
SHCruz8-Dec-16 16:26
SHCruz8-Dec-16 16:26 
QuestionSelect columns access database Pin
Member 128225738-Dec-16 0:08
Member 128225738-Dec-16 0:08 
AnswerRe: Select columns access database Pin
Richard MacCutchan8-Dec-16 1:24
mveRichard MacCutchan8-Dec-16 1:24 
GeneralRe: Select columns access database Pin
Member 128225738-Dec-16 3:36
Member 128225738-Dec-16 3:36 
Hi,

Well the problem is that with the code i used, I see the records, but the data is not in line.
For example:
I have 2 columns ID and Test. Both columns have e.g. 2 records (or rows)
Normal you would expect to see two columns and two rows.
I my case i see 2 columns and 4 rows, the first two rows of columns 2 are empty.
I know this has something to with the way i have program it, but I don't know the correct way.

Herewith my code:
VB
Private Sub btnShowData_Click(sender As Object, e As EventArgs) Handles btnShowData.Click


       Dim selectFile As String = txtSelectFile.Text
       Dim selectTable As String = cmbSelectTable.Text

       con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & selectFile

       Try

           con.Open()

           Dim ds As New DataSet
           Dim dt As New DataTable

           Dim da As New OleDbDataAdapter


           For Each Item As Object In lbxSelectItems.Items

               da = New OleDbDataAdapter("Select " & Item & "  from " & selectTable, con)

               da.Fill(dt)

           Next


           DGVselectedTable.DataSource = dt.DefaultView

           con.Close()


       Catch ex As Exception
           MsgBox("Error: " & ex.Message)

       End Try

   End Sub


I hope it is clear, basically I was hoping for a good example or code.

thanks

kind regards,
heng
GeneralRe: Select columns access database Pin
Richard MacCutchan8-Dec-16 3:52
mveRichard MacCutchan8-Dec-16 3:52 
GeneralRe: Select columns access database Pin
Member 128225738-Dec-16 6:28
Member 128225738-Dec-16 6:28 
GeneralRe: Select columns access database Pin
Richard MacCutchan8-Dec-16 6:44
mveRichard MacCutchan8-Dec-16 6:44 
QuestionProgressbar feedback (one fill another) Pin
SHCruz5-Dec-16 22:49
SHCruz5-Dec-16 22:49 
QuestionRe: Progressbar feedback (one fill another) Pin
CHill606-Dec-16 5:08
mveCHill606-Dec-16 5:08 
AnswerRe: Progressbar feedback (one fill another) Pin
SHCruz7-Dec-16 11:59
SHCruz7-Dec-16 11:59 
QuestionVB.net - Index was out of range. Must be non-negative and less than the size of the collection Listview Pin
Abung Salman2-Dec-16 16:46
Abung Salman2-Dec-16 16:46 
QuestionRe: VB.net - Index was out of range. Must be non-negative and less than the size of the collection Listview Pin
Richard MacCutchan2-Dec-16 22:04
mveRichard MacCutchan2-Dec-16 22:04 
AnswerDon't post your question in multiple forums Pin
Dave Kreskowiak3-Dec-16 3:26
mveDave Kreskowiak3-Dec-16 3:26 
AnswerRe: VB.net - Index was out of range. Must be non-negative and less than the size of the collection Listview Pin
Richard Deeming5-Dec-16 2:00
mveRichard Deeming5-Dec-16 2:00 
QuestionQuestion about Class Interaction Pin
hilli_micha1-Dec-16 10:32
hilli_micha1-Dec-16 10:32 
AnswerRe: Question about Class Interaction Pin
Richard Deeming1-Dec-16 11:00
mveRichard Deeming1-Dec-16 11:00 
GeneralRe: Question about Class Interaction Pin
hilli_micha1-Dec-16 11:10
hilli_micha1-Dec-16 11:10 
GeneralRe: Question about Class Interaction Pin
Richard Deeming1-Dec-16 11:18
mveRichard Deeming1-Dec-16 11:18 
GeneralRe: Question about Class Interaction Pin
hilli_micha2-Dec-16 18:38
hilli_micha2-Dec-16 18:38 
QuestionConvert VB to C# Pin
Pavlex429-Nov-16 7:00
Pavlex429-Nov-16 7:00 
AnswerRe: Convert VB to C# Pin
Wendelius29-Nov-16 7:25
mentorWendelius29-Nov-16 7:25 

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.