Re: FileSystemWatcher .Path string
Quote:
Originally Posted by
Arjay
There a a few approaches. One is you bind the ui list to your underlying list collection. The the click can access the current item in the list. If you aren't binding, then when you insert the ui list rows from the list collection, add a tag with the index to the current list position. When a click occurs, retrieve the tag value and use it to retrieve the item.
Sounds like binding the ui list to the collection is the more concise approach. I've done some binding of data before, but I don't know if it's what you're referring to.
This topic has sort of deviated from the original title...should it be moved into a new thread to accommodate the new topic of interest?
Re: FileSystemWatcher .Path string
No need to move the thread. How are you displaying the list in the ui (feel free to start a new thread if you like)?
Re: FileSystemWatcher .Path string
Quote:
Originally Posted by
Arjay
No need to move the thread. How are you displaying the list in the ui (feel free to start a new thread if you like)?
Up to this point I haven't used the list for the ui. The only plan I had for it was to recall the plan object and enable or disable it from the list. I update the ui when there are changes, but that's done reading the database. I probably need more experience with lists. Give me your input on it.
Re: FileSystemWatcher .Path string
Quote:
Originally Posted by
KGCole
Up to this point I haven't used the list for the ui. The only plan I had for it was to recall the plan object and enable or disable it from the list. I update the ui when there are changes, but that's done reading the database. I probably need more experience with lists. Give me your input on it.
It depends on how you've implemented your ui list. Zip up a sample solution that shows how a list of items is displayed on a ui. Then I can help you.
Re: FileSystemWatcher .Path string
Here's the basic method I use to read my database into the listbox. Nothing fancy, just using OleDbDataReader to feed items into the list:
Code:
Public Sub GetPlans()
Dim myConn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=..\..\Resources\BakDb.accdb")
Dim cmd As New OleDbCommand
chkCnt = 0
Try
LstBxPlanBackup.Items.Clear()
str = "SELECT COUNT(*) FROM Backup"
cmd.CommandText = str
cmd.Connection = myConn
myConn.Open()
cntPlns = Convert.ToInt32(cmd.ExecuteScalar())
myConn.Close()
str = "SELECT Nickname, Base, Target FROM Backup"
cmd.CommandText = str
cmd.Connection = myConn
myConn.Open()
Dim lstReader As OleDbDataReader = cmd.ExecuteReader()
lstReader.Read()
Do Until chkCnt = cntPlns
LstBxPlanBackup.Items.Add(lstReader.Item(0))
chkCnt += 1
lstReader.Read()
Loop
myConn.Close()
LstBxPlanBackup.SelectedIndex = 0
Catch ex As Exception
myConn.Close()
LblNickNote1Backup.Text = "Trouble connecting to database to list your plans"
End Try
LblNickNote1Backup.Text = ""
LblNickNote2Backup.Text = ""
LstBxPlanBackup.SelectedItem = TxtBxNickBackup.Text
MakePlanStr()
End Sub