Advertisement

05.11.2008 at 01:26PM PDT, ID: 23393041
[x]
Attachment Details

Problem with a ShowDialog form and focus of a textbox VB.Net

Asked by nomar2 in Microsoft Visual Basic.Net

Working with VB.Net

The problem is the end user wanted a custom message box to pop up in the middle of an action under the click of a button..

They click the button and a I have custom message box to pop up... I use this code to display it..

 fMsgBoxPos.ShowDialog()
 lnReceiptAction = fMsgBoxPos.lReceiptPrint

 On the form the user is asked if they want to print a receipt and a yes/ no either a 0 or 1 is sent back to the main form and a receipt is/is't print...this works...

The problem is once this action is complete I want the focus to go back to a textbox on the main form...this was working, but since I added the fMsgBoxPos.ShowDialog(), I can't get the focus to appear in the textbox

On the custom form..this is the code I have under the Yesy/ No buttons
'yes button on the click action on custom form
  lReceiptPrint = 1
   Me.Close()

it seems like when I close the custom form the focus stays there and doesn't go back to the textbox I want ...

this is the code for the set focus call..
'main form
     txt_Invoice.Focus()
      txt_Invoice.Text = ""
      txt_Invoice.Focus()

Any help or insight would be much appreciated...Start Free Trial
[+][-]05.11.2008 at 02:11PM PDT, ID: 21543506

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Visual Basic.Net
Sign Up Now!
Solution Provided By: Idle_Mind
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628