| | |
Wait for user response before doing anything.
![]() |
•
•
Join Date: Jan 2005
Posts: 6
Reputation:
Solved Threads: 0
Hi,
Apologies if I'm missing something really easy here:
I have a TabStrip with 4 tabs on my form. When the user is editing the information on one of the tabs I want to display a message box confirming whether the data should be saved. Here is what I have:
The program will switch to the new tab before displaying the message. Is there any way I can show the message box first then decide whether to switch tabs?
Thanks in advance,
Andy.
Apologies if I'm missing something really easy here:
I have a TabStrip with 4 tabs on my form. When the user is editing the information on one of the tabs I want to display a message box confirming whether the data should be saved. Here is what I have:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub tabMainForm_Click(PreviousTab As Integer) If editing Then If MsgBox("Save changes?", vbYesNoCancel, applicationTitle) = vbYes Then cmdSave_Click (tabMainForm.Tab) End If End If If tabMainForm.Tab = 1 Then staffRst.Fields("BI") = CalculateBI staffRst.Update txtBI.Text = staffRst.Fields("BI") End If End Sub
The program will switch to the new tab before displaying the message. Is there any way I can show the message box first then decide whether to switch tabs?
Thanks in advance,
Andy.
Try the change event, if there's an cancel property on their parameter then use it. or maybe the mousedown event.
A conclusion is the place where you got tired of thinking. http://www.martin2k.co.uk/forums/index.php?showforum=4
http://www.a1vbcode.com/a1vbcode/vbforums/Forum3-1.aspx
http://www.developerfusion.co.uk/for...orum&ForumID=4
•
•
•
•
I have a TabStrip with 4 tabs on my form. When the user is editing the information on one of the tabs I want to display a message box confirming whether the data should be saved.
If Changing from one tab to another,
set editing flag on All the controls change event (Current Tab) and clear it after the confirmation. Suppose Text1 is in First Tab, then
vb Syntax (Toggle Plain Text)
Dim bEditing As Boolean Private Sub tabMainForm_Click(PreviousTab As Integer) If bEditing Then Select Case MsgBox("Save changes?", vbYesNoCancel, applicationTitle) = vbYes Case vbYes cmdSave_Click (tabMainForm.Tab) Case vbNo Case vbCancel Exit Sub End Select End If 'ClearFlag bEditing = False End Sub Private Sub Text1_Change() bEditing = True End Sub
Last edited by selvaganapathy; Jan 27th, 2009 at 11:11 pm.
KSG
•
•
Join Date: Jan 2005
Posts: 6
Reputation:
Solved Threads: 0
Thank you both for your replies, the MouseDown event worked fine, but I now have the same problem with a ListBox.
The names of items are listed in a ListBox, when an item is selected its details are filled into several TextBoxes underneath the list.
Basically I need the same kind of thing; if the user tries to select a different list item while editing = True then I want to display the message and perform no action. The MouseDown event is firing but the ListIndex is still changing.
Any ideas? I know I could set the ListBox.Enabled = False but I would rather use a simpler solution as before.
Hope someone can help,
Andy
The names of items are listed in a ListBox, when an item is selected its details are filled into several TextBoxes underneath the list.
Basically I need the same kind of thing; if the user tries to select a different list item while editing = True then I want to display the message and perform no action. The MouseDown event is firing but the ListIndex is still changing.
Any ideas? I know I could set the ListBox.Enabled = False but I would rather use a simpler solution as before.
Hope someone can help,
Andy
![]() |
Similar Threads
- Postal code program, need help to get in right direction (Java)
- VB Notification box (Visual Basic 4 / 5 / 6)
- Forms authorization, only want a few links (ASP.NET)
- another newbie with alot of redhat and apache server Q'S (Linux Servers and Apache)
- HJT logfile that I'd appreciate some help with (Viruses, Spyware and other Nasties)
- Sendmail problem (*nix Software)
- Helping yourself: What to do before starting a new thread or posting a HiJackThis log (Viruses, Spyware and other Nasties)
- Obtain Remote Assistance Using Windows Messenger in Windows XP (Windows tips 'n' tweaks)
- No Posts? (DaniWeb Community Feedback)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: import excel from access
- Next Thread: vb6 help with deleting files
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






