Hi all,
I am using visual studio, VB .net
i have a form with a "Support" button which may be pushed as often as
wished. If the current name is "result 1", then "result 2" should be
displayed in the text box. If the current name is "result 2", then
"result 1" will appear again.
I have tried the following
thanks in advance,
Static iStatus as integer
iStatus = abs(iStatus -1)
if iStatus=1 then
Field1.txt="result 2"
else
Field1.txt="result 1"
end if
the problem is the I get the error
name 'abs' is not declared
can anybody help, is above the right method at all?
greetings
Murt 5 1961
* "Murt" <Mu**********@ATyahoo.DOTcom> scripsit: I am using visual studio, VB .net
i have a form with a "Support" button which may be pushed as often as wished. If the current name is "result 1", then "result 2" should be displayed in the text box. If the current name is "result 2", then "result 1" will appear again.
I have tried the following
thanks in advance, Static iStatus as integer iStatus = abs(iStatus -1) if iStatus=1 then Field1.txt="result 2" else Field1.txt="result 1" end if
the problem is the I get the error name 'abs' is not declared
Use 'Math.Abs' instead. Make sure the 'System' namespace is imported.
--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
"Murt" <Mu**********@ATyahoo.DOTcom> schrieb Hi all,
I am using visual studio, VB .net
i have a form with a "Support" button which may be pushed as often as wished. If the current name is "result 1", then "result 2" should be displayed in the text box. If the current name is "result 2", then "result 1" will appear again.
I have tried the following
thanks in advance, Static iStatus as integer iStatus = abs(iStatus -1) if iStatus=1 then Field1.txt="result 2" else Field1.txt="result 1" end if
the problem is the I get the error name 'abs' is not declared
Probably "abs" is neither a local variable, nor a member of the class, nor a
member of the same or enclosing namespaces, nor a member of imported
namespaces/classes.
Use Math.Abs or System.Math.Abs
can anybody help, is above the right method at all?
Seems to be right. Alternatives:
istatus = (istatus+1) mod 2
- or -
static iStatus as boolean
iStatus = not iStatus
if iStatus then
field1.text = "result2"
else
field1.text = "result1"
end if
--
Armin
thanks Herfried,
that did the trick
Murt
Herfried K. Wagner [MVP] wrote: * "Murt" <Mu**********@ATyahoo.DOTcom> scripsit:
I am using visual studio, VB .net
i have a form with a "Support" button which may be pushed as often as wished. If the current name is "result 1", then "result 2" should be displayed in the text box. If the current name is "result 2", then "result 1" will appear again.
I have tried the following
thanks in advance, Static iStatus as integer iStatus = abs(iStatus -1) if iStatus=1 then Field1.txt="result 2" else Field1.txt="result 1" end if
the problem is the I get the error name 'abs' is not declared
Use 'Math.Abs' instead. Make sure the 'System' namespace is imported.
Hi Murt,
In cases where you <are> dealing with numbers, you can often look at
things the 'other way round'
iStatus = 1 - iStatus '0 then 1, then 0
I would use Armin's Boolean method myself - it's the clearest.
Regards,
Fergus
"Murt" <Mu**********@ATyahoo.DOTcom> wrote...
I see others have answered your first question and an alternative was
presented... I'll offer one more based on the idea that keeping track of a
boolean state to change a boolean state is probably not necessary. By that
I mean, if you happen to have a static boolean sitting around to indicate
the state of more than just the button text I'd probably use it (it really
is the "indicator" at that point) but if all it does is keep track of what
the text should look like there is a little point.
So you get:
if ( field1.text = "result1" ) then
field1.text = "result2"
else
field1.text = "result1"
end if
or my personal preference:
field1.text = iif(field1.text = "result1", "result2", "result1" ) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Adrian |
last post by:
I need to have 2 submit buttons in one form calling the same page. I just
need to know which was used. Being able to pass a hidden form input for
each would be ideal. How can I do this??
...
|
by: TrvlOrm |
last post by:
Can any one please help me...I am new to JavaScript and I have been
struggling with this code for days now and can't figure it out.
I would like to get the Buttons to correspond with the action...
|
by: Tammy |
last post by:
What would be a good alternative to using frames? I need something
that will section my webpage into two halves and can change both
frames on a single click.
Thanks in Advance,
Tammy
|
by: Adam |
last post by:
Hey guys,
I've decided to stop banging my head against the wall and just ask you
guys for the answer. I can't seem to find it.
I have a form in which I have multiple submit buttons; only, I'm...
|
by: Les Juby |
last post by:
I've used a simple javascript for some time (no entries required up in
the <head> tag) that asks for a confirmation before deleting.
ie.
<a href="/delete.asp?which=345 %>"...
|
by: NishSF |
last post by:
Would anyone have any suggestions/javascript code so that if one clicks
the Radio Button "Yes" below he has the option of selecting any of the
six CheckBox below. If the user clicks on Radio Button...
|
by: bluez |
last post by:
I want to design a webpage where user can search the data from the database and list out the related records. Each of the record got a delete button which allow user to delete the record.
...
|
by: rahulnag22 |
last post by:
I have created a button widget with a button click binding. The button
initially has a state=disabled. I can see the greyed out version of
the button in the GUI. But If I click on the button it...
|
by: rookiejavadude |
last post by:
I'm have most of my java script done but can not figure out how to add a few buttons. I need to add a delete and add buttong to my existing java program. Not sure were to add it on how. Can anyone...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |