-
Listview
hi, guys
i need help with listview, after populate it with data, and after recall it after data inserted, av a repeated column head.
please help me out
-
Huh??? Okay, I'll take a stab at deciphering your question...
You have a LV control that you use for data entry and display, but when you go to redisplay the data that you entered, you have a duplicate column like two first name columns. Well if that is right, look at your sql statement where you select the records from the database to see if you have something like...
strSQL = "SELECT fname, fname, lname, dob FROM tablename WHERE ...
If that is not the problem and the control is not a bound control, then have a look at where you set the columns up and populate the data...
Good Luck
-
hi, please found below the code for the list view fill
Code:
Private Sub PopulateListView()
Dim rdGetData As SqlClient.SqlDataReader
Dim intCount As Decimal = 0
Dim lobjCommand As SqlCommand
Me.ListView1.Items.Clear()
Me.ListView1.View = View.Details
ListView1.Columns.Add("Account Type", 100, HorizontalAlignment.Left)
ListView1.Columns.Add("Account Type No", 110, HorizontalAlignment.Left)
ListView1.Columns.Add("Account Name", 100, HorizontalAlignment.Left)
ListView1.Columns.Add("Account No", 100, HorizontalAlignment.Left)
Dim MySQL As String = "SELECT AcctType, AccTypeNo, AcctName, AcctNo FROM tblChartAcct ORDER BY AcctType"
Try
lobjCommand = New System.Data.SqlClient.SqlCommand(MySQL, SQLConn)
SQLConn.Open()
rdGetData = lobjCommand.ExecuteReader
While rdGetData.Read()
Dim lvl As New ListViewItem(New String() {rdGetData.GetValue(0), rdGetData.GetValue(1).ToString, rdGetData.GetValue(2), rdGetData.GetValue(3).ToString})
'MsgBox(rdGetData.GetString(2))
Me.ListView1.Items.Add(lvl)
End While
rdGetData.Close()
Catch ex As Exception
MessageBox.Show(ex.ToString)
Finally
SQLConn.Close()
End Try
End Sub
End Class
and i have the code, it ok
please, help
Last edited by Hack; 05-26-2010 at 11:59 AM.
-
What version of Visual Basic are you using?
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista
-
i am using visual studio basic 2008 for the coding
-
Then I will move your thread to the correct forum section, which is here, in .NET
Does the code you posted in Post #3 work or not work for you?
I am not completely understanding your question.
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista
-
it works fine, if i call the module class in form load, but after insert record into the database and recall the same method, i have a mutlipe column heading. e.g all the column head will repeated without data but blank.
thank you for your help
-
Then remove these lines from the sub routine. You don't need them recreated each time you run it
Code:
ListView1.Columns.Add("Account Type", 100, HorizontalAlignment.Left)
ListView1.Columns.Add("Account Type No", 110, HorizontalAlignment.Left)
ListView1.Columns.Add("Account Name", 100, HorizontalAlignment.Left)
ListView1.Columns.Add("Account No", 100, HorizontalAlignment.Left)
Just delete those lines altogether and create the column headings from the listview property page in design.
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista
-
hi,
thanks for the help you, hack and Good morning
Similar Threads
-
By vb_programmer in forum VB Classic
Replies: 1
Last Post: 09-16-2006, 07:37 PM
-
By Birhanu in forum VB Classic
Replies: 0
Last Post: 11-09-2001, 03:26 PM
-
By Birhanu in forum VB Classic
Replies: 0
Last Post: 11-09-2001, 03:26 PM
-
By Kenneth in forum VB Classic
Replies: 0
Last Post: 04-24-2001, 11:04 AM
-
By Diego in forum VB Classic
Replies: 1
Last Post: 08-28-2000, 08:15 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks