|
Add an EventHandler for the child window closing in the parent form handle the things in the EventHandler.
Hope this will help.
|
|
|
|
|
Hi, in VB6 I use the following code to create the column header of listview:
Dim clhChildActivities As ColumnHeader
With lvwFoundResult.ColumnHeaders
' "eQµaHkumar";"kabrieqäT";"eQµaHGñkTTYlxusRtÚv";"skmµPaB"
Set clhChildActivities = .Add(1, , "eQµaHkumar")
Set clhChildActivities = .Add(2, , "kabrieqäT")
Set clhChildActivities = .Add(3, , "eQµaHGñkTTYlxusRtÚv")
Set clhChildActivities = .Add(4, , "skmµPaB")
Set clhChildActivities = .Add(5, , "epSg²")
End With
It is working fine
Then I use the following code to transfer the data from the database to list view item and subitem:
Do While .EOF = False
DoEvents
Set ltmChildActivities = lvwFoundResult.ListItems.Add(, , Trim(.Fields(0).Value))
For intSubItemRec = 1 To .Fields.Count - 1
DoEvents
ltmChildActivities.SubItems(intSubItemRec) = _
Trim(.Fields(intSubItemRec).Value)
Next
.MoveNext
pgbRecFound.Value = pgbRecFound.Value + 1
Loop
and it is working fine too
Now I move to VB.NET, I use the following code to call the field from Ms access database to create the column header in list view in VB.NET:
' ******************************************************
'
' Pass the field value to the column header
' of list view.
Dim i As Integer ' Total number of column.
For i = 0 To myReader.FieldCount - 1
lvwCustomers.Columns.Add(myReader.GetName(i).ToString, _
100, HorizontalAlignment.Center)
Next
'
' Pass the field value to the column header is success.
'
' *****************************************************
it also working fine too
And i got the following sample code that add an item and subitem to the list view:
'Dim str(5) As String
'Dim itm As ListViewItem
'str(0) = "Rob Machy"
'str(1) = "100 North Ave"
'str(2) = "Business Manager"
'str(3) = "89,000"
'str(4) = "Development"
'itm = New ListViewItem(str)
'lvwCustomers.Items.Add(itm)
That also working fine
BUT
when I try to transfer the data from database to an item and subitem to the list view as the following code:
' Use Read method of the OleDbDataReader to retrieve data
' use it to GetString method to display data in list view.
Dim ltm As ListViewItem
Dim str(myReader.FieldCount) As String
Dim j As Integer
While myReader.Read()
'txtData.Text = txtData.Text & myReader.GetString(0) & _
'ControlChars.CrLf
For j = 1 To myReader.FieldCount
Try
ltm = New ListViewItem(myReader.GetString(j).ToString)
Catch exSice As System.InvalidCastException
MsgBox("Error occure")
Catch exIofre As System.IndexOutOfRangeException
MsgBox("Check the index of field and index of listview.")
End Try
Next
lvwCustomers.Items.Add(ltm)
End While
it is not success... Can any one help me to transfer the data from database to the list view item and sub item???
Here is the full procedure of the code:
<code>Private Sub btnLoadToListView_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnLoadToListView.Click
' Create the query string and
' define new OleDbConnection object.
'Dim mySelectQuery As String = "SELECT CompanyName FROM " & _
'"Suppliers"
Dim mySelectQuery As String
mySelectQuery = "SELECT * FROM Customers"
Dim myConnection As New OleDbConnection("Provider=" & _
"Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\" & _
"Microsoft Office\Office10\Samples\Northwind.mdb")
' Create new OleDbCommand.
Dim myCommand As New OleDbCommand(mySelectQuery, myConnection)
' Open the connection.
myConnection.Open()
' Declare an OleDbDatareader and use ExecuteReader method
' of OleDbCommand to populate it.
Dim myReader As OleDbDataReader
myReader = myCommand.ExecuteReader()
' ******************************************************
'
' Pass the field value to the column header
' of list view.
Dim i As Integer ' Total number of column.
For i = 0 To myReader.FieldCount - 1
lvwCustomers.Columns.Add(myReader.GetName(i).ToString, _
100, HorizontalAlignment.Center)
Next
'
' Pass the field value to the column header is success.
'
' *****************************************************
' Use Read method of the OleDbDataReader to retrieve data
' use it to GetString method to display data in list view.
Dim ltm As ListViewItem
Dim str(myReader.FieldCount) As String
Dim j As Integer
While myReader.Read()
'txtData.Text = txtData.Text & myReader.GetString(0) & _
'ControlChars.CrLf
For j = 1 To myReader.FieldCount
Try
ltm = New ListViewItem(myReader.GetString(j).ToString)
Catch exSice As System.InvalidCastException
MsgBox("Error occure")
Catch exIofre As System.IndexOutOfRangeException
MsgBox("Check the index of field and index of listview.")
End Try
Next
lvwCustomers.Items.Add(ltm)
End While
' Close OleDbDataReader and OleDbConnection.
myReader.Close()
myConnection.Close()
End Sub</code>
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
I have check in my northwind database with Customers table. I found that some field contain NULL value. I check the field number and count the process of For Next statement and found the error become from NULL value of some field. Can anyone tell me how to transfer the NULL value to listview item and ignore an error?
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
Ok, may be nobody will help me. I got the information from here[^] to solve the problem with NULL value.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
How do I make a taskbar notification window like the one I see when somebody on MSN signs in? (the blue/white box above the taskbar)
Note: I'm using VB6, not VB.NET
|
|
|
|
|
Active-X Popup MsgBox's
http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=46003&lngWId=-1
|
|
|
|
|
I am learning VB.Net and need to know how to restrict the input of a textbox to numbers only.
Di
|
|
|
|
|
In win forms you can use the Validating event then use the regular experssions classes to match to [0-9]. Web forms have a regular expression validator control.
|
|
|
|
|
Hello,
How can i make "MSDN Style Help in Vb.net".
Or
kindly tell me any software in which i will easily make help file (like MSDN), but that software must has UNICODE support.
Regards,
Eshban
EsHbAn BaHaDuR
|
|
|
|
|
hi could u tell me how i can put the controlbox on the right of the form by using vb6.0 language
Thanks alot
Metal Man
|
|
|
|
|
|
hi all,
i have a text box in screen of Great plains Product and i want to detremine it's location accroding to the windows screen ,how can i do this? as i really need it
thank you
|
|
|
|
|
Use the ClientRectangle property of the Control Class
|
|
|
|
|
hi there i have treeview and list view on my project i want to make them right to left to be arabic enabled how i can do this on vb6.0
Thanks alot
Metal Man
|
|
|
|
|
You asked this question before and I told you that the TreeView control doesn't properly support drawing from right to left. As before, your best bet for a properly drawn TreeView in Arabic is to use a third party control, like TreeViewX from Infragistics.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I want to make a circular-shaped form in VB6. How can I do it? Do I need Windows APIs or something else?
|
|
|
|
|
A window that's star-shaped, circular or tank-shaped
http://www.vbaccelerator.com/home/VB/Code/Libraries/Graphics_and_GDI/Changing_Window_Shapes/index.asp
|
|
|
|
|
Hi, I have an idea to build a database in SQL server to store the information of appoint for each staff in my organization. Now I decide to build an application in VB.NET or ASP.NET to show each staff information in the calendar. When they are free, when they are busy. Because it is the first time that I have to do that, I need to find any resource to guide me through the beginning step. I don't know where to begin to do that. Can any give me some idea or solution?
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
Maybe of no help to you, but microsoft exchange does a better job of that than any software I've seen yet.
|
|
|
|
|
In my organization, we just want to use calendar over the network. Ms Exchange is very big software, if we install it just using calendar, I think it is useless. So my program director ask me to do that task. I think I might combine this software with VB.Net or ASP.NET and SQL server.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
Databound Schedule control
By Jos Branders
http://www.codeproject.com/aspnet/schedule.asp?df=100&forumid=71964&select=893684#xx893684xx
|
|
|
|
|
|
Thank you very much for your information, I also check get the similar information from http://www.c-sharpcorner.com/Code/2003/July/ASPNetCalendarControl.asp[^] but it is not working whether I have made change to some code in the connection string and table.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
Hi, can any one tell me how to post the picture with the message in this code project forum? Sometime I want to explian the other people by using picture, but I don't know how to do that.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
It's not supported by CodeProjects Forum's code. You can post the image to a webstie somewhere and include a link to the image on your website. You cannot post the image to the forum directly.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|