SEARCH YOUR SOLUTION HERE  

validate event doesn't fire with default button

My vb6 form as an OK button with default=true and causesvalidation=true When the user clicks the OK button with the mouse, it correctly fires the validate event before the click event, but when the user presses the return key, ...

Posted On: Saturday 10th of November 2012 02:03:45 AM Total Views:  281
View Complete with Replies




Related Messages:

Unable to detect contents in textbox for keypress event   (234 Views)
Hi all... I have a problem here.. I have a textbox for entering custid. When the user presses the ENTER key within the textbox, it is supposed to search through the database for all records relevant to that custid. However, ...
Passing an object ByRef in an event via ActiveX   (349 Views)
This is more of a theory question than anything, but here goes. If I have an ActiveX DLL early bound by a standard EXE, there should be no reason that I can't do this (I think)... My.DLL::Class1 --------------- Public Event ...
catching an event   (247 Views)
Hi all Im trying to do an ActiveX control which is container - is any way to catch events of controls placed on my control (their parent). For example GotFocus or LostFocus
How to code under image1_MouseMove event   (281 Views)
I want to load two pictures into an image control at these periods 1. When the mouse is over the image control 2. When the mouse has left the image control I got this Lines of code (from the net) that work for mousemove event on Picturebox control but unlucky for me it deosn't work for Image control. 'If (X < 0) Or (Y < 0) Or (X > Picture1.Width) Or (Y > Picture1.Height) Then ' the MOUSELEAVE pseudo-event 'ReleaseCapture 'the mouse is gone, so do appropriate stuff 'Picture1.Picture = LoadPicture(App.Path & "\Images\1B.jpg ") 'ElseIf (X > 0) Or (Y > 0) Or (X < Picture1.Width) Or (Y < Picture1.Height) Then ' the MOUSEENTER pseudo-event 'SetCapture Picture1.hwnd 'the mouse is over picture box. do approrpiate stuff 'Picture1.Picture = LoadPicture(App.Path & "\Images\1BB.jpg ") 'End If Can anyone help me with
How to code multiple events   (237 Views)
Hi. I am really new at this and need to find out how to code multiple events so that I don't have to type the same thing out many times as you can see I have done below. I am sure there is a way to do it but I am lost. It is for a Mastermind game and I have created 8 buttons from which you can drag the text number on the button into a text box. there are 20 text boxes. 5 x rows of 4 textboxes. I have started to try to do it for button 1 but I am confused. I have tried to copy from other people's code but it is just confusing me more. Can someone please put me on the right track. Private Sub Button1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseDown, Button2.MouseDown,Button3.MouseDown,Button4.MouseDown,_ Button5.MouseDown, Button6.MouseDown, Button7.MouseDown, Button8.MouseDown Dim Txtbox As TextBox Txtbox = CType(sender, TextBox) Txtbox.Select() Button1.DoDragDrop(Button1.Text, DragDropEffects.Copy) End Sub Private Sub txtGuess1_R1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtGuess1.DragEnter If (e.Data.GetDataPresent(DataFormats.Text)) Then e.Effect = DragDropEffects.Copy Else e.Effect = DragDropEffects.None End If End Sub Private Sub txtGuess1_R1_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtGuess1.DragDrop txtGuess1.Text = e.Data.GetData(DataFormats.Text).ToString Button1.Text = "1" Button2.Text = "2" Button3.Text = "3" Button4.Text = "4" Button5.Text = "5" Button6.Text = "6" Button7.Text = "7" Button8.Text = "8" End Sub Private Sub Button2_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button2.MouseDown Button2.DoDragDrop(Button2.Text, DragDropEffects.Copy) End Sub Private Sub txtGuess2_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtGuess2.DragEnter If (e.Data.GetDataPresent(DataFormats.Text)) Then e.Effect = DragDropEffects.Copy Else e.Effect = DragDropEffects.None End If End Sub Private Sub txtGuess2_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtGuess2.DragDrop txtGuess2.Text = e.Data.GetData(DataFormats.Text).ToString Button1.Text = "1" Button2.Text = "2" Button3.Text = "3" Button4.Text = "4" Button5.Text = "5" Button6.Text = "6" Button7.Text = "7" Button8.Text = "8" End Sub Private Sub Button3_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button3.MouseDown Button3.DoDragDrop(Button3.Text, DragDropEffects.Copy) End Sub Private Sub txtGuess3_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtGuess3.DragEnter If (e.Data.GetDataPresent(DataFormats.Text)) Then e.Effect = DragDropEffects.Copy Else e.Effect = DragDropEffects.None End If End Sub Private Sub txtGuess3_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtGuess3.DragDrop txtGuess3.Text = e.Data.GetData(DataFormats.Text).ToString Button1.Text = "1" Button2.Text = "2" Button3.Text = "3" Button4.Text = "4" Button5.Text = "5" Button6.Text = "6" Button7.Text = "7" Button8.Text = "8" End Sub Private Sub Button4_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button4.MouseDown Button4.DoDragDrop(Button4.Text, DragDropEffects.Copy) End Sub Private Sub txtGuess4_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtGuess4.DragEnter If (e.Data.GetDataPresent(DataFormats.Text)) Then e.Effect = DragDropEffects.Copy Else e.Effect = DragDropEffects.None End If End Sub Private Sub txtGuess4_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtGuess4.DragDrop txtGuess4.Text = e.Data.GetData(DataFormats.Text).ToString Button1.Text = "1" Button2.Text = "2" Button3.Text = "3" Button4.Text = "4" Button5.Text = "5" Button6.Text = "6" Button7.Text = "7" Button8.Text = "8" End Sub Private Sub Button5_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button5.MouseDown Button5.DoDragDrop(Button5.Text, DragDropEffects.Copy) End Sub Private Sub txtGuess5_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtGuess5.DragEnter If (e.Data.GetDataPresent(DataFormats.Text)) Then e.Effect = DragDropEffects.Copy Else e.Effect = DragDropEffects.None End If End Sub Private Sub txtGuess5_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtGuess5.DragDrop txtGuess5.Text = e.Data.GetData(DataFormats.Text).ToString Button1.Text = "1" Button2.Text = "2" Button3.Text = "3" Button4.Text = "4" Button5.Text = "5" Button6.Text = "6" Button7.Text = "7" Button8.Text = "8" End Sub Private Sub Button6_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button6.MouseDown Button6.DoDragDrop(Button6.Text, DragDropEffects.Copy) End Sub Private Sub Button7_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button7.MouseDown Button7.DoDragDrop(Button7.Text, DragDropEffects.Copy) End Sub Private Sub Button8_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button8.MouseDown Button8.DoDragDrop(Button8.Text, DragDropEffects.Copy) End Sub Private Sub txtGuess6_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtGuess6.DragEnter If (e.Data.GetDataPresent(DataFormats.Text)) Then e.Effect = DragDropEffects.Copy Else e.Effect = DragDropEffects.None End If End Sub Private Sub txtGuess6_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtGuess6.DragDrop txtGuess6.Text = e.Data.GetData(DataFormats.Text).ToString Button1.Text = "1" Button2.Text = "2" Button3.Text = "3" Button4.Text = "4" Button5.Text = "5" Button6.Text = "6" Button7.Text = "7" Button8.Text = "8" End Sub Private Sub txtGuess7_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtGuess7.DragEnter If (e.Data.GetDataPresent(DataFormats.Text)) Then e.Effect = DragDropEffects.Copy Else e.Effect = DragDropEffects.None End If End Sub Private Sub txtGuess7_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtGuess7.DragDrop txtGuess7.Text = e.Data.GetData(DataFormats.Text).ToString Button1.Text = "1" Button2.Text = "2" Button3.Text = "3" Button4.Text = "4" Button5.Text = "5" Button6.Text = "6" Button7.Text = "7" Button8.Text = "8" End Sub Private Sub txtGuess8_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtGuess8.DragEnter If (e.Data.GetDataPresent(DataFormats.Text)) Then e.Effect = DragDropEffects.Copy Else e.Effect = DragDropEffects.None End If End Sub Private Sub txtGuess8_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtGuess8.DragDrop txtGuess8.Text = e.Data.GetData(DataFormats.Text).ToString Button1.Text = "1" Button2.Text = "2" Button3.Text = "3" Button4.Text = "4" Button5.Text = "5" Button6.Text = "6" Button7.Text = "7" Button8.Text = "8" End Sub Private Sub txtGuess9_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtGuess1_R3.DragEnter If (e.Data.GetDataPresent(DataFormats.Text)) Then e.Effect = DragDropEffects.Copy Else e.Effect = DragDropEffects.None End If End Sub Private Sub txtGuess9_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtGuess1_R3.DragDrop txtGuess1_R3.Text = e.Data.GetData(DataFormats.Text).ToString Button1.Text = "1" Button2.Text = "2" Button3.Text = "3" Button4.Text = "4" Button5.Text = "5" Button6.Text = "6" Button7.Text = "7" Button8.Text = "8" End Sub Private Sub txtGuess10_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtGuess2_R3.DragEnter If (e.Data.GetDataPresent(DataFormats.Text)) Then e.Effect = DragDropEffects.Copy Else e.Effect = DragDropEffects.None End If End Sub Private Sub txtGuess10_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtGuess2_R3.DragDrop txtGuess2_R3.Text = e.Data.GetData(DataFormats.Text).ToString Button1.Text = "1" Button2.Text = "2" Button3.Text = "3" Button4.Text = "4" Button5.Text = "5" Button6.Text = "6" Button7.Text = "7" Button8.Text = "8" End Sub Private Sub txtGuess11_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtGuess3_R3.DragEnter If (e.Data.GetDataPresent(DataFormats.Text)) Then e.Effect = DragDropEffects.Copy Else e.Effect = DragDropEffects.None End If End Sub Private Sub txtGuess11_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtGuess3_R3.DragDrop txtGuess3_R3.Text = e.Data.GetData(DataFormats.Text).ToString Button1.Text = "1" Button2.Text = "2" Button3.Text = "3" Button4.Text = "4" Button5.Text = "5" Button6.Text = "6" Button7.Text = "7" Button8.Text = "8" End Sub
WebBrowser.Navigating event problem   (271 Views)
In Visual Basic 6.0, i used to get PostData and Headers in the BeforeNavigate2 event handler function. But when i upgrade to Visual Studio 2005, i got it upgraded to Navigating event handler and there is no PostData and Headers in the handler function. How to access PostData and Headers value in the Navigating function. Event Handler in VB 6.0 Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean) Event Handler in VS 2005 Private Sub WebBrowser1_Navigating(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles WebBrowser1.Navigating
Using GetFwt function, rather than xCalcButton's Click event pro   (160 Views)
I' trying to use the GetFwt function to determine which radio button is selected by the user. I seem ok with doing it through the click event procedure in the code below but can't make the darn GetFwt function work. Any ideas or suggestions Option Explicit On Option Strict On Public Class MainForm Private Function GetFwt(ByVal marital As String, _ ByVal numow As Integer, _ ByVal weekPay As Decimal) As Decimal ' returns the FWT Const Withow As Decimal = 63.46D Dim taxableWages As Decimal Dim tax As Decimal ' calculate taxable wages taxableWages = _ weekPay - Convert.ToDecimal(numow) * Withow ' determine marital status, then calculate FWT If marital = "S" Then Select Case taxableWages Case Is
Why can 'Enter' not be caught with the event 'Form_KeyDown' if a button is on the form   (220 Views)
I have a blank form with only one Label. With the following code I can catch each pressed key with the event 'Form_KeyDown': Option Explicit Private Sub Form_Load() Me.KeyPreview = True End Sub Private Sub Form_KeyDown(KeyCode As Integer, Shift As ...
event data project   (159 Views)
Am a event planner and i want a progmme which will help me remmber my client anniversary, kindly tell me what i need and how to go about it. Thank you
raise event   (227 Views)
I am trying to raise an event and and not sure how to go about it this is my code so far Private Sub button1_click(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) RaiserdoAdditionEvent() If (rdoAddition.Click = True) Then Me.Hide() Math.Show() End If End Sub
Make Click event Object Oriented   (144 Views)
I need to make this click event object oriented using a class with 3 instances variables.. Here I have the code...just need help on putting everything together to make work properly...THANKS in advance... ption Explicit On Imports System.Globalization Public Class MainForm 'declare instance variables of Mainform Private myCurrent As Loan Private myRate As Loan Private myNper As Loan Private isConverted As Boolean Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'instantiate an objects myCurrent = New Loan() myRate = New Loan() MyNper = New Loan() End Sub Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click Me.Close() End Sub Private Sub ResetButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ResetButton.Click principalTextBox.Clear() IntTextBox.Clear() TermTextBox.Clear() End Sub Private Sub CalcButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalcButton.Click Dim Rate As Decimal Dim Nper As Double Dim PV As Double Dim CalculateTotal As Loan Dim value As Decimal Dim total As Decimal Dim Current As Double ' Setting the values to each of our variables. Rate = value Nper = 4 PV = value If isConverted Then 'calculate total total = CalculateTotal() PaymentsLabel.Text = total End If End Sub End Class [/code [code] Public Class Loan 'instance variables Private _current As Decimal Private _rate As Decimal Private _nper As Decimal ' constructor Public Sub New(Optional ByVal theCurrent As Decimal = 0, _ Optional ByVal theRate As Decimal = 0, _ Optional ByVal theNper As Decimal = 0) _current = theCurrent _rate = theRate _nper = theNper End Sub 'Property procedures Public Property Current() As Decimal Get Return _current End Get Set(ByVal value As Decimal) _current = value End Set End Property 'Property procedures Public Property Rate() As Decimal Get Return _rate End Get Set(ByVal value As Decimal) _rate = value End Set End Property 'Property procedures Public Property Nper() As Decimal Get Return _nper End Get Set(ByVal value As Decimal) _nper = value End Set End Property Public Function CalculateTotal() As Decimal Return -Financial.Pmt(Rate, Nper, Current) End Function End Class
VB hates its own event proc syntax???   (293 Views)
I have a simple form with, among other things, an ADODC data control (called "Adodc1"). The ADO connection to the database tests fine but when I try to add code to any of the Adodc1 control's event procs and then ...
KeyPress Event & MouseDown event   (181 Views)
I'm writing a program that is designed for quick navigation using specific buttons on the keyboard. In doing this, I have added a KeyPress event for every control on the form to intercept the key pressed and pass it to ...
Editfields - Scrolling event and Vertical scroll in pixels?   (253 Views)
It's been too long since I delved into the nitty gritty of the editfield, so hopefully someone can shortcut my research. Is there a way of getting the current vertical scroll offset in pixels of an edit field. editfield.ScrollPosition returns ...
Is a flush events method available?   (211 Views)
Is there a way to flush keyboard and mouse events On a slow machine, or for a lengthy process, the incoming events can pile up creating an annoying user experience. As an example, scrolling through a series of large pictures ...
Button to validate input   (268 Views)
I tried to use this script to validate the input of the form Ford. When I use the Input ype Button the script is OK I want to use a picture as a button but then the script does not ...
How to validate file name in VB 5.0?   (170 Views)
I am getting an input file name from a dialog box. What's the best way to ensure it is a valid file name The only way I know of is to try to open the file an trap the error. ...
How can I validate an email address?   (203 Views)
I want to validate email addresses that are entered into a textbox in my program. When a command button is pressed I want the program to look for the charachter "@" in the text box and if it isnt found i want a message box to tell the user they have entered an invalid email address.
validate data and import to Ms excel   (233 Views)
Sir, We use foxbase file in our branch offices.The data from foxbase is culled out and sent to head office thro' mail. In our Head office,we have to merge as an Ms Excel file, all data so received .Before merging, we have to validate the data in each cell.For,example the cell which contains date should be in dd/mm/yyyy format or there should not be blank cell and so on... Please guide me how to use vb6 o vba to validate data in dbf file and append in an Ms Excel file.There should be an error message in case of invalid data. Thanking You, Ravichandran J
This is my vb6 code with backend sql2000. Code is not able to validate   (364 Views)
Private Sub Command1_Click() Dim conn1 As New ADODB.Connection Dim cmd1 As New ADODB.Command Dim rs1 As New ADODB.Recordset Dim p As Integer Dim accessconnect, n, a, num, ty As String accessconnect = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=master;Data Source=POOJA-D4FD585E2\SQL2000" conn1.ConnectionString = accessconnect conn1.Open n = Text1.Text a = Text2.Text p = Val(Text3.Text) num = Text4.Text ty = Text5.Text cmd1.ActiveConnection = conn1 cmd1.CommandText = " insert into customer(customer_name,customer_address,customer_phn,cutomer_dob,account_number,account_type) values(' " & n & " ' , ' " & a & " ',' " & p & " ' , ' " & DTPicker1.Value & " ',' " & num & " ' , ' " & ty & " ')" Set rs1 = cmd1.Execute conn1.Close MsgBox ("DATABASE UPDATED SUCCESSFULLY") End Sub Private Sub Text1_Validate(Cancel As Boolean) n = Text1.Text If n = (" ") And (Len(n) < 3) Then MsgBox ("Enter valid customer name") End If End Sub Private Sub Text2_Validate(Cancel As Boolean) a = Text2.Text If a = (" ") And (Len(a) < 3) Then MsgBox ("Enter valid address") End If End Sub Private Sub Text3_Validate(Cancel As Boolean) p = Val(Text3.Text) If Not IsNumeric(p) And p = (" ") And (Len(p) < 10) Then MsgBox "Please enter numbers only." End If End Sub Private Sub Text4_Validate(Cancel As Boolean) num = Text4.Text If num = (" ") Then MsgBox ("Account number cannot be null ") End If End Sub Private Sub Text5_Validate(Cancel As Boolean) ty = Text5.Text If ty = (" ") Then MsgBox ("Enter a type of account ") End If End Sub I am a beginner so I am not able to figure it out what is the error this code is not able to validate