-
I need a code example for this question. I have a ListView control and a text box on my form, set up like you would see in most e-mail clients with the list of messages up top and a preview pane below, and when you click on a row in the listview it shows the message in the preview pane.
If my user edits the text in the text box, I want to prompt them to save before they move to another "message". How would I write the validation code for this?
-
Do you have the text stored in a text file or dynamicly in the code? If it's a text file then simply Have a msgbox pop up asking if the user wants to save. Then if vbYes is clicked then write the new info into the textfile.
Code:
Open "test.txt" For Output As #1
Print #1, Text1.Text
Close #1
Hope that somehow helps,
D!m
-
But when a user goes from one line to another, how do I have it run validation code for the record (line)?
-
Admittedly, I have very little experience with the ListView control, but it would make sense that you could probably put your validation code inside of the Itemchecked event. This would run when an item in the listview is selected. So all you would have to do is place the previously checked item's listindex into a global variable (or better yet, property), and then use it to run your validation code. I hope this is useful. Any other ideas?
-
I actually think that doing that will work, but if there are any more ideas, I would greatly appreciate them.