Click here to Skip to main content
16,004,887 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Creating a File Menu Pin
jady8410-Jan-07 1:49
jady8410-Jan-07 1:49 
GeneralRe: Creating a File Menu Pin
ChandraRam10-Jan-07 1:57
ChandraRam10-Jan-07 1:57 
GeneralRe: Creating a File Menu Pin
Colin Angus Mackay10-Jan-07 2:04
Colin Angus Mackay10-Jan-07 2:04 
QuestionHow to Get Execution Time Pin
suveenmohan9-Jan-07 23:15
suveenmohan9-Jan-07 23:15 
AnswerRe: How to Get Execution Time Pin
testy_proconsul9-Jan-07 23:56
testy_proconsul9-Jan-07 23:56 
Questionlistview problem ini vb.net 2005 Pin
amaneet9-Jan-07 23:10
amaneet9-Jan-07 23:10 
AnswerRe: listview problem ini vb.net 2005 Pin
johnny19639-Jan-07 23:49
johnny19639-Jan-07 23:49 
Questionlistview Pin
johnny19639-Jan-07 21:01
johnny19639-Jan-07 21:01 
I use visual basic 2005
I have a listview on my form whit a datasourse from the dataset
so i wil see the data frorm the dataset in the listview.
When i do that the first column of the listview is empty how is that possible
I create a class called listview.vb with following code

Imports System.Data.SqlClient

Public Class ListViewData
Public Sub FillListView(ByRef MyListView As ListView, ByRef myData As SqlDataReader)
Dim lvwColumn As DataColumn
Dim itmListItem As ListViewItem
Dim shtCntr As Short

For shtCntr = 0 To myData.FieldCount()
lvwColumn = New DataColumn()
MyListView.Show()
Next

Do While myData.Read
itmListItem = New ListViewItem()

For shtCntr = 0 To myData.FieldCount() - 1
If myData.IsDBNull(shtCntr) Then

itmListItem.SubItems.Add("")
Else

itmListItem.SubItems.Add(myData.GetValue(shtCntr))

End If
Next shtCntr

MyListView.Items.Add(itmListItem)
Loop
End Sub
End Class

and the code for the form is:

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myCon As SqlClient.SqlConnection
Dim sqlCmd As SqlClient.SqlCommand = New SqlClient.SqlCommand("SELECT * FROM contacten")
Dim myData As SqlClient.SqlDataReader
Dim itmListviewItem As New ListViewItem
Dim lvhHelper As ListViewData = New ListViewData()

myCon = New SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\contacten.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True")

Try
myCon.Open()
sqlCmd.Connection = myCon
myData = sqlCmd.ExecuteReader
lvhHelper.FillListView(ListView1, myData)
myCon.Close()

Catch eSql As System.Data.SqlClient.SqlException
MessageBox.Show(eSql.ToString)
End Try

End Sub

Can someone tell wth is wrong ??????
AnswerRe: listview Pin
johnny196310-Jan-07 0:45
johnny196310-Jan-07 0:45 
GeneralRe: listview Pin
johnny196311-Jan-07 6:58
johnny196311-Jan-07 6:58 
Questionglobalization/localization Pin
tawiskid099-Jan-07 19:50
tawiskid099-Jan-07 19:50 
AnswerRe: globalization/localization Pin
testy_proconsul9-Jan-07 21:24
testy_proconsul9-Jan-07 21:24 
QuestionGet and Set property in vb.net Pin
amaneet9-Jan-07 19:24
amaneet9-Jan-07 19:24 
AnswerRe: Get and Set property in vb.net Pin
Christian Graus9-Jan-07 20:24
protectorChristian Graus9-Jan-07 20:24 
AnswerRe: Get and Set property in vb.net Pin
Guffa9-Jan-07 22:51
Guffa9-Jan-07 22:51 
AnswerRe: Get and Set property in vb.net Pin
Dave Kreskowiak10-Jan-07 5:09
mveDave Kreskowiak10-Jan-07 5:09 
QuestionI want to get the .txt and .Doc file's contents. Pin
somagunasekaran9-Jan-07 19:08
somagunasekaran9-Jan-07 19:08 
AnswerRe: I want to get the .txt and .Doc file's contents. Pin
Christian Graus9-Jan-07 20:27
protectorChristian Graus9-Jan-07 20:27 
GeneralRe: I want to get the .txt and .Doc file's contents. Pin
somagunasekaran9-Jan-07 23:33
somagunasekaran9-Jan-07 23:33 
GeneralRe: I want to get the .txt and .Doc file's contents. Pin
Christian Graus10-Jan-07 0:22
protectorChristian Graus10-Jan-07 0:22 
QuestionMy.Settings question Pin
sa_runner9-Jan-07 19:06
sa_runner9-Jan-07 19:06 
AnswerRe: My.Settings question Pin
Johan Hakkesteegt11-Jan-07 3:37
Johan Hakkesteegt11-Jan-07 3:37 
Questiondatabase tables search in vb.net Pin
amaneet9-Jan-07 18:42
amaneet9-Jan-07 18:42 
AnswerRe: database tables search in vb.net Pin
testy_proconsul10-Jan-07 0:00
testy_proconsul10-Jan-07 0:00 
GeneralRe: database tables search in vb.net Pin
amaneet10-Jan-07 0:35
amaneet10-Jan-07 0:35 

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.