Private Sub cmdCalculate_Cl ick(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles cmdCalculate.Cl ick
If txtName.Text <> "" Then
If txtUnits.Text <> "" Then
If optOne.Checked Or optTwo.Checked Or optThree.Checke d
Or optFour.Checked Then
'Data fine
Else
MessageBox.Show ("Please choos an option button")
End If
Else
MessageBox.Show ("txtUnits")
txtUnits.Focus( )
End If
Else
MessageBox.Show ("txtName")
txtName.Focus()
End If
End Sub
Private Sub cmdO_Click(ByVa l sender As Object, ByVal e As
System.EventArg s) Handles cmdO.Click
Call cmdCalculate_Cl ick()
End Sub
I have the two functions as stated above; now the call statement returns
the error:
C:\vbNet\beginn ing\nested_if\F orm1.vb(141): Argument not specified for
parameter 'e' of 'Private Sub cmdCalculate_Cl ick(sender As Object, e As
System.EventArg s)'.
PLS HELP
THANX
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! 6 2114
Radith Silva wrote: Private Sub cmdCalculate_Cl ick(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles cmdCalculate.Cl ick
Call cmdCalculate_Cl ick()
I have the two functions as stated above; now the call statement returns the error: C:\vbNet\beginn ing\nested_if\F orm1.vb(141): Argument not specified for parameter 'e' of 'Private Sub cmdCalculate_Cl ick(sender As Object, e As System.EventArg s)'.
yea well, you omitted both parameters for cmdCalculate_Cl ick. Obviosuly,
that is wrong.
Try
\\\
cmdCalculate_Cl ick(Nothing, Nothing)
///
btw: why do you write "Call"?
--
Konrad - http://madrat.net/
"Radith Silva" <ra****@xtra.co .nz> schrieb Private Sub cmdCalculate_Cl ick(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles cmdCalculate.Cl ick If txtName.Text <> "" Then If txtUnits.Text <> "" Then If optOne.Checked Or optTwo.Checked Or optThree.Checke d Or optFour.Checked Then 'Data fine Else MessageBox.Show ("Please choos an option button") End If Else MessageBox.Show ("txtUnits") txtUnits.Focus( ) End If Else MessageBox.Show ("txtName") txtName.Focus() End If End Sub
Private Sub cmdO_Click(ByVa l sender As Object, ByVal e As System.EventArg s) Handles cmdO.Click Call cmdCalculate_Cl ick() End Sub
I have the two functions as stated above; now the call statement returns the error: C:\vbNet\beginn ing\nested_if\F orm1.vb(141): Argument not specified for parameter 'e' of 'Private Sub cmdCalculate_Cl ick(sender As Object, e As System.EventArg s)'.
Better approach (IMO):
private sub Calculate()
If txtName.Text <> "" Then
If txtUnits.Text <> "" Then
If optOne.Checked Or optTwo.Checked Or optThree.Checke d Or
optFour.Checked Then
'Data fine
Else
MessageBox.Show ("Please choos an option button")
End If
Else
MessageBox.Show ("txtUnits")
txtUnits.Focus( )
End If
Else
MessageBox.Show ("txtName")
txtName.Focus()
End If
end sub
Private Sub cmdCalculate_Cl ick(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles cmdCalculate.Cl ick
Calculate()
end sub
Private Sub cmdO_Click(ByVa l sender As Object, ByVal e As System.EventArg s)
Handles cmdO.Click
Calculate
End Sub
- OR -
Delete Sub cmdO_Click and have Sub cmdCalculate_Cl ick handle the click of
both controls:
Private Sub cmdCalculate_Cl ick(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles cmdCalculate.Cl ick, cmdO.Click
Notice the 2nd event after "Handles".
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
"Radith Silva" <ra****@xtra.co .nz> schrieb Private Sub cmdCalculate_Cl ick(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles cmdCalculate.Cl ick If txtName.Text <> "" Then If txtUnits.Text <> "" Then If optOne.Checked Or optTwo.Checked Or optThree.Checke d Or optFour.Checked Then 'Data fine Else MessageBox.Show ("Please choos an option button") End If Else MessageBox.Show ("txtUnits") txtUnits.Focus( ) End If Else MessageBox.Show ("txtName") txtName.Focus() End If End Sub
Private Sub cmdO_Click(ByVa l sender As Object, ByVal e As System.EventArg s) Handles cmdO.Click Call cmdCalculate_Cl ick() End Sub
I have the two functions as stated above; now the call statement returns the error: C:\vbNet\beginn ing\nested_if\F orm1.vb(141): Argument not specified for parameter 'e' of 'Private Sub cmdCalculate_Cl ick(sender As Object, e As System.EventArg s)'.
Better approach (IMO):
private sub Calculate()
If txtName.Text <> "" Then
If txtUnits.Text <> "" Then
If optOne.Checked Or optTwo.Checked Or optThree.Checke d Or
optFour.Checked Then
'Data fine
Else
MessageBox.Show ("Please choos an option button")
End If
Else
MessageBox.Show ("txtUnits")
txtUnits.Focus( )
End If
Else
MessageBox.Show ("txtName")
txtName.Focus()
End If
end sub
Private Sub cmdCalculate_Cl ick(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles cmdCalculate.Cl ick
Calculate()
end sub
Private Sub cmdO_Click(ByVa l sender As Object, ByVal e As System.EventArg s)
Handles cmdO.Click
Calculate
End Sub
- OR -
Delete Sub cmdO_Click and have Sub cmdCalculate_Cl ick handle the click of
both controls:
Private Sub cmdCalculate_Cl ick(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles cmdCalculate.Cl ick, cmdO.Click
Notice the 2nd event after "Handles".
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
Radith,
In addition to the other's comments, you can also use Button.PerformC lick. Private Sub cmdO_Click(ByVa l sender As Object, ByVal e As System.EventArg s) Handles cmdO.Click
cmdCalculate.Pe rformClick()
End Sub
This way if you have multiple handlers for a given button, then all the
handlers will be invoked.
Although I prefer to use Armin's first example. I normally have a single
handler both handle the same event.
Remember VB.NET event model is not your VB6 event model! You can have
multiple handlers for a given event, plus a given event handler can handle
events from multiple objects.
Notice in the following "Button_Cli ck" handles the click event for all three
buttons, while each button also has their own specific handler. This would
be handy if you have some common logic that needed to occur for every click,
plus some specific logic for every click. Or the buttons occur in the base
form and the base form wants to handle the events, plus the derived form
wants to handle the events...
Private WithEvents Button1 As Button
Private WithEvents Button2 As Button
Private WithEvents Button3 As Button
Private Sub Button_Click(By Val sender As Object, ByVal e As System.EventArg s) Handles Button1.Click, Button2.Click, Button3.Click End Sub
Private Sub Button1_Click(B yVal sender As Object, ByVal e As System.EventArg s) Handles Button1.Click End Sub
Private Sub Button2_Click(B yVal sender As Object, ByVal e As System.EventArg s) Handles Button2.Click End Sub
Private Sub Button3_Click(B yVal sender As Object, ByVal e As System.EventArg s) Handles Button3.Click End Sub
Hope this helps
Jay
"Radith Silva" <ra****@xtra.co .nz> wrote in message
news:eB******** ******@TK2MSFTN GP12.phx.gbl... Private Sub cmdCalculate_Cl ick(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles cmdCalculate.Cl ick If txtName.Text <> "" Then If txtUnits.Text <> "" Then If optOne.Checked Or optTwo.Checked Or optThree.Checke d Or optFour.Checked Then 'Data fine Else MessageBox.Show ("Please choos an option button") End If Else MessageBox.Show ("txtUnits") txtUnits.Focus( ) End If Else MessageBox.Show ("txtName") txtName.Focus() End If End Sub
Private Sub cmdO_Click(ByVa l sender As Object, ByVal e As System.EventArg s) Handles cmdO.Click Call cmdCalculate_Cl ick() End Sub
I have the two functions as stated above; now the call statement returns the error: C:\vbNet\beginn ing\nested_if\F orm1.vb(141): Argument not specified for parameter 'e' of 'Private Sub cmdCalculate_Cl ick(sender As Object, e As System.EventArg s)'.
PLS HELP
THANX *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
* "Konrad L. M. Rudolph" <ko************ @madrat.net> scripsit: yea well, you omitted both parameters for cmdCalculate_Cl ick. Obviosuly, that is wrong.
Try
\\\ cmdCalculate_Cl ick(Nothing, Nothing) ///
btw: why do you write "Call"?
I would call the button's 'PerformClick' method. Instead of passing
'Nothing', you should pass a reference to the button in the 1st
parameter and 'EventArgs.Empt y' in the 2nd parameter.
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Hi Radith,
A lot of answers mostly on click events, I give another approach however
more with the point to show you the purpose of the OrElse operator.
I also give another method for that click event (Keep in mind there is no
best and there are much more methods).
Private Sub cmdCalculate_Cl ick(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles cmdCalculate.Cl ick
If txtName.Text <> "" Then
If txtUnits.Text <> "" Then
If optOne.Checked OrElse optTwo.Checked OrElse
optThree.Checke d
The OrElse stops evaluating when the condition is True.
OrElse optFour.Checked Then
'Data fine
Else
MessageBox.Show ("Please choos an option button")
End If
Else
MessageBox.Show ("txtUnits")
txtUnits.Focus( )
End If
Else
MessageBox.Show ("txtName")
txtName.Focus()
End If
End Sub
Private Sub cmdO_Click(ByVa l sender As Object, ByVal e As
System.EventArg s) Handles cmdO.Click
cmdCalculate_Cl ick(sender, e) 'Only when the signatures are equal
as in this case
End Sub This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Alex |
last post by:
I am having difficulty writing a SQL statement and I was wondering if one of
you gurus could help me. I have a table that has three fields: InvoiceID,
Item, ItemPrice. Each InvoiceID is associated with one or more Items. I am
trying to write a SQL statement that returns the record (all three fields)
for the least expensive item for each invoice (so the total number of
records returned will be equal to the total number of unique Invoice IDs....
|
by: Kid A |
last post by:
I am writing stored proecdures on Oracle 9 (release 1 I believe). I am
having difficulty creating a stored procedure that makes a remote
function call to a database on a different host.
On the remote database I declare the following package:
----------
create or replace package remote_package
as
|
by: Adam Nemitoff |
last post by:
Is is possible to construct a SELECT statement that contains a WHERE
clause that uses the value from a column in the "next" row?
ie. given a table with a single field named "myField" with the
following values I want a SELECT statement that selects the rows
"WHERE myField='1' and myField = '2' ":
5
6
1
|
by: Marc Mones |
last post by:
Hello,
I'working with IBM DB2 V8.1 and CLI/ODBC. I've got a problem with the
following
statement:
********************************************************************************
SELECT S_ART, S_SPRACHE, S_MANDANT, S_NR, S_SUB, S_OWNER, S_SATZ
FROM SY0001_00005
WHERE S_ART = ? AND S_SPRACHE = ? AND S_MANDANT = ? AND S_NR = ? AND
|
by: mygoogleaccount |
last post by:
Hi,
may be someone could help me ?
i need to use cyrillic letters in a php application.
I changed everything to UTF-8 and it works fine. The only problem are
CYRILLIC SMALL LETTER ES
CYRILLIC SMALL LETTER YA
| |
by: arne |
last post by:
Hi all,
imagine I call a function, but omit one of the parameters, like:
foo.c:
void foo( int a, int b ) {
/* do something with a and b */
return;
}
|
by: savio XCIX |
last post by:
I created the following stored procedure:
=======
CREATE PROCEDURE TBLNAME.proc_test (IN p_custnum VARCHAR(8),
IN p_zipcode CHAR(5),
OUT r_valid CHAR(1),
OUT r_bal DECIMAL(9,2))
LANGUAGE SQL
BEGIN
|
by: BenRatcliffe |
last post by:
Hi there,
I was wondering if anyone could help me. I have a comlpex database with a number of forms that have data entered on them and then saved into the correct table etc. In this instance I am trying to get the data on a form to save the data in the current table where it is stored, insert the data into 2 new tables all on a click event. I have got the first 2 tables to update fine but the third I am having difficulty with.
The third...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |