|
I think you want to use the Click event, not AfterUpdate. AfterUpdate only fires after any change in the controls data. Selecting items in the ListBox does not fire the AfterUpdate event.
|
|
|
|
|
Its weird though, If I put Message Boxes throughout the code, everytime I click, it actually does fire the AfterUpdate() event.
For example, I placed a MsgBox inside the loop but outside the if statement to check to see if the loop is working: MsgBox "loop works".
Then I placed a MsgBox inside the if statement: MsgBox "if works"
Then I placed a MsgBox inside the event, but after the loop executes: MsgBox "post loop works"
I get "loop works" and "post loop works" to come up, but not "if works".
So its having troubles verifying my selected item. There are two Selected properties (one in Access, and one in MSForms). The default one when I write my code seems to come up with the Access Selected version. The thing I think is the issue here is, this returns a Long value...you would think Boolean. However, the MSForms version of Selected under a ListBox returns a Boolean...I just can't figure out how to call that version of it. It seems to always call the Access version.
With this extra information, do you have any ideas? Thanks again Dave.
|
|
|
|
|
If it's an Access Form ListBox, the it will call the Access version. Period. You cannot change that. According to the docs, ListBox.Selected(index) takes a Long (32-bit signed integer) as an arugment and returns a Boolean if that item is selected or not.
Does the selection highlight disappear after your AfterUpdate code runs?? If it does, then AfterUpdate fires AFTER the data is changed and the selections are removed. In which case, yes, all of your "is selected?" compares will return false.
|
|
|
|
|
No, it stays highlighted...I even tried changing it to a Click Event Routine. Didn't help.
My if statement is:
If ListBox.Selected(iterator) Then ' iterator is defined as a Long, but I have also tried Integer
End If
Nothing inside the if block is executing...which makes me think there is something wrong with the ListBox.Selected(iterator). This just seems too bizarre.
|
|
|
|
|
Wait, could it be because my original ListBox's Row Source Type is Table/Query rather than Value List? Right now I'm using an Access Query to populate the list...would it make a difference if I were to set up the SQL query in the VB Editor and populate it as a Value List?
|
|
|
|
|
OK. I knew I gave up on Access development for a reason... actually, LOTS of reasons...
If the ListBox's MultiSelect property is "None", you can get the selected item index number from the ListBox.ListIndex property.
If the ListBox's MultiSelect property is NOT "None", you can get the selected items index numbers from the ListBox.ItemsSelected collection.
|
|
|
|
|
Thanks, the ListIndex property worked wonders!
|
|
|
|
|
hi all,
i am developing a windows application, where in which i have taken a form to insert some records,
My Question is ...
after i insert a record the form should be in the same MDI
actually i put, xyz form on my Main MDI form and i am using this insertion formm on my xyz form,
so here, my doubt is how to ristrict my form's multiple instances in the xyz form which is agian in MDI
the code that i wrote is
If FDAStatusChange_cmbProtocolFDAStatus.Text = "" Then
MessageBox.Show("Please select a Protocol FDA Status", "Trial Traking System", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
Try
con.Open()
intversionid = objdalversions.VERSION_ID
Dim intUserId = 1
Dim strFDAStatus As String = FDAStatusChange_cmbProtocolFDAStatus.Text.Trim
Dim strFDAStatus_name As String = "select dbo.F14_FDA_Status_ID(FDA_STATUS) from T6_PROTOCOL_FDA_STATUS where FDA_STATUS='" & strFDAStatus & "'"
Dim cmd1 = New SqlCommand(strFDAStatus_name, con)
Dim intFDAStatisID As Integer = cmd1.ExecuteScalar()
objFDAStatusChange.T3_PROTOCOL_VERSIONS_ID = intVersionId
objFDAStatusChange.T6_PROTOCOL_FDA_STATUS_ID = intFDAStatisID ' CTAStatusChange_cmbProtocolCTAStatus.Text.Trim()
objFDAStatusChange.FDA_Status_Date = FDAStatusChange_dtFDAStatusDate.Value
objFDAStatusChange.FDA_STATUS_Comments = txt_FDA_Comments.Text.Trim()
objFDAStatusChange.DOCUMENTED_DATE = System.DateTime.Today
objFDAStatusChange.T50_User_ID_CREATED_BY = intUserId
objFDAStatusChange.PROTOCOL_FDA_STATUS_TRACKING_CREATED_ON = System.DateTime.Today
objFDAStatusChange.CreateFDAChangeStatus(objFDAStatusChange)
con.Close()
MessageBox.Show("Successfully Saved", "Trial Traking System", MessageBoxButtons.OK, MessageBoxIcon.Information)
Me.Close()
Catch ex As Exception
MessageBox.Show("Save Error", "Trial Traking System", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End If
Prashanth
|
|
|
|
|
This should not be an MDI form but down as a dialog.
The MDI solution is incredibly easy. All you have to do is create a flag that you set when you create an instance of the form. But, before you create that instance, check the status of the flag. If it's already set, just don't create the new instance!
This does not sound like a candidate for an MDI application. MDI stands for Multiple DOCUMENT Interface, not multiple forms. MDI was designed so you can have multiple documents open and edit them all using the same interface. Nothing is your code or post suggests that what this app is doing, so I have to question why you're even using MDI.
|
|
|
|
|
Hi, Im just started on developing a keylogger and have a dll that helps me capture keystrokes. Im looking for ideas and suggestions of how to go about this whole project. Assistance of any kind is highly appreciated.
erkertsa
|
|
|
|
|
akatsa wrote: Im looking for ideas and suggestions of how to go about this whole project.
Bin it. The last thing the world needs is more spyware.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton
My website
|
|
|
|
|
You're joking, right?
99.9% of the time a keylogger is illegal to use. So, you want help with what again? Something illegal? I don't think so.
|
|
|
|
|
Dave Kreskowiak wrote: 99.9% of the time a keylogger is illegal to use.
Not all. I wrote a key logger one time just to track how much and how fast I typed.
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
|
Am writing on genetic algorithm for nurse duty rostering and got hooked in my coding.can anyone send me samples in vb6.0 or java.for a period of one month or more.my email address is sopsophia@yahoo.com
Thanks
|
|
|
|
|
First, don't cross post. Second, your cross post in the Vista forum makes no sense. Third, if you are having problems post the code you have thus far, tell us the error and we will see if we can help you. Just asking for us to give you code is considered rude.
______________________
stuff + cats = awesome
|
|
|
|
|
Java is an academic language, because it is free. Genetic algorithms are academic playgrounds. If you search for Genetic Algorithm and Java, you will find many stable already complete and robust libraries.
Pualee
Edit: and they are free
|
|
|
|
|
For a movie project(in vb.net 2005), i have to store the availabilty of seat (100 checkboxes) in a textfile.According to the value of textfile like "True" or "false" ,i have to make the enable property of checkbox as enabled or disabled.The checkboxes are named as A1,A2,A3,..,A10
B1,B2..B10.Can anyone help me for this question ?
|
|
|
|
|
What kind of format is this textfile set up in? In other words, how are you determining whether the checkbox control should be enabled to true or false?
|
|
|
|
|
Thanks. The textfile is in the format of T;T;F;T;T;T;T;T;F;T .This pattern in ten rows. "T" stands for true (that is that seat is available for booking) and "f" for false .
|
|
|
|
|
Set up a counter to count the rows in your text file (this number should be incremented each time your text file goes to the next row when reading it)
Set up an index that will represent each seat when going through the row.
Loop through each row character by character, and have if statements checking whether its true or false
When looping, have if statements that will check the row count, and assign that to an alphabetic character representing your checkbox. ie. when rowcount is 1, it means A, 2, B, etc.
The index for each character will let you know which checkbox you are referring to. So if you're in rowcount 1, and your loop index is currently at 5 (i=5) or something, then you know you're dealing with control A5...once that is verified is just a simple call like A5.Enabled = True, or A5.Enabled = False, depending on if the character you are checking was T or F.
|
|
|
|
|
Thanks. Still i am not getting how i can retrieve the name of checkbox. How i get (name of checkbox).enabled.i have 100 checkboxes to change their enable property.I am stuck here .
My code is like this
Friend spider1Seat(9, 9) As String
Dim rowNames() As String = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J"}
Dim colNames() As Integer = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
Private Sub lstSessionTime_SelectedIndexChanged
Dim row As Integer
Dim col As Integer
Dim readArray() As String
row = .cboMovieName.SelectedIndex
col = .lstSessionTime.SelectedIndex
If row = 0 And col = 0 Then
seatReader = New StreamReader("Spider1Seat.txt")
Do While seatReader.Peek <> -1
readArray = Split(seatReader.ReadLine, ";")
For ctr2 As Integer = 0 To rownames.length-1
spider1Seat(ctr, ctr2) = readArray(ctr2)
If spider1Seat(ctr, ctr2) = "T" Then
End If
Next
ctr += 1
Loop
End If
|
|
|
|
|
Dim cb As CheckBox = CType(Me.Controls.Find("A1", True)(0), CheckBox)
cb.Checked = True
|
|
|
|
|
Thank you everyone.I got the logic form u people.It worked.
|
|
|
|
|
first you would have to read the text file
and for every line in the text file (wich I assumse corrisponds with the letter (line1=A, line2=B)) you dynamicly enable or disable the checkbox
this is how I did it (made a little example but can't attach it here so just the code then)
its only for 2 rows but should work fine for how many you want
(remember I made it in 5 min so there are things that could be better)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
Dim fs As New System.IO.StreamReader("C:\Documents and Settings\Tom\Mijn documenten\test.txt")<br />
Dim rows As New List(Of String)<br />
rows.Add("A")<br />
rows.Add("B")<br />
Dim row As Integer = 0<br />
Do While Not fs.EndOfStream<br />
Dim s() As String = fs.ReadLine.Split(";")<br />
Dim column As Integer = 1<br />
Do While column < s.Length + 1<br />
enabledisableseat(rows.Item(row), column, IIf(s(column - 1).Equals("T"), True, False))<br />
column += 1<br />
Loop<br />
row += 1<br />
Loop<br />
End Sub<br />
<br />
Private Sub enabledisableseat(ByVal row As String, ByVal column As Integer, ByVal enable As Boolean)<br />
For Each c As Control In Me.Controls<br />
If c.GetType.Equals(GetType(CheckBox)) Then<br />
Dim chk As CheckBox = c<br />
If chk.Name.Equals(row & column) Then<br />
chk.Enabled = enable<br />
End If<br />
End If<br />
Next<br />
End Sub
I hope this helps you on your way
|
|
|
|
|