Where is the "default" property of the Command Button Object in VB.net

S

simonoficina

Hello all! I am a vb.net beginner in Spain. When I use VB6 ,the button
object has a property called "default" that can set this button like
press "ENTER" key. But in the VB.net I can't find this property. Where
is it? Or mabye change the other thing,No?Thanks ! Simon
 
G

gene kelley

Hello all! I am a vb.net beginner in Spain. When I use VB6 ,the button
object has a property called "default" that can set this button like
press "ENTER" key. But in the VB.net I can't find this property. Where
is it? Or mabye change the other thing,No?Thanks ! Simon

(VB2005)

That behavior is now limited to one or two buttons on any given form.

Look at the form's properties "AcceptButton" and "CancelButton". If a button exists on a form it
can be assigned as the "AcceptButton", and, likewise for a "CancelButton".

Gene
 
T

Tom Shelton

Hello all! I am a vb.net beginner in Spain. When I use VB6 ,the button
object has a property called "default" that can set this button like
press "ENTER" key. But in the VB.net I can't find this property. Where
is it? Or mabye change the other thing,No?Thanks ! Simon

For the most part, the concept of a "default" property has gone away.
In VB.NET, only an indexed property can be marked as default using an
attribute. Which, IMHO, is a very good thing. I always was one of
those wackos that thought the use of default properties were evil....


You can mark declare a default property using the default keyword.
 
G

Greg

Tom Shelton said:
For the most part, the concept of a "default" property has gone away.
In VB.NET, only an indexed property can be marked as default using an
attribute. Which, IMHO, is a very good thing. I always was one of
those wackos that thought the use of default properties were evil....


You can mark declare a default property using the default keyword.

Actually, the functionality is still there in VB.NET, but it has been moved
to the form itself.
Now every form "has a" default button property, whereby a button object can
be assigned to this property of the form.
In the form's properties go to the AcceptButton and CancelButton and choose
the required button from the dropdown lists.

Cheers,
Greg
 
T

Tom Shelton

Tom said:
For the most part, the concept of a "default" property has gone away.
In VB.NET, only an indexed property can be marked as default using an
attribute. Which, IMHO, is a very good thing. I always was one of
those wackos that thought the use of default properties were evil....


You can mark declare a default property using the default keyword.

Boy did I misread the your post... Sorry :)
 
C

Cor Ligthert [MVP]

We are in the 21st century, 25 years after the first PC and people still
want a Keyboard enter instead of a pointing device click or whatever.

Amazing.

Are there still people out there using only a 16" floppy disk?

This is what I had to think about reading the OP's question.
And surely not out of the topic.

Cor
 
G

Greg

Sometimes your application may require typing some text into a field. A
simple press of the Enter key would then run the application rather than
taking your hand off the keyboard and putting it on the mouse and then
clicking a button. The keyboard Enter and the Mouse pointing device will run
the same default button code so you can choose EITHER not 'one INSTEAD of
the other'.

Cheers.
 
C

Cor Ligthert [MVP]

Greg,

I thought that it was the default behaviour of a webbrowser, you don't mind
that I say that I don't like it

I am in the middle of a text, want to go to a new line or tab or whatever
but my text is send.

:)

Cor
 
H

Herfried K. Wagner [MVP]

Cor Ligthert said:
We are in the 21st century, 25 years after the first PC and people still
want a Keyboard enter instead of a pointing device click or whatever.

Amazing.

Huh?! I believe I am not the only one who is using the keyboard extensively
to enter data and click buttons...
 
C

Cor Ligthert [MVP]

Huh?! I believe I am not the only one who is using the keyboard
extensively to enter data and click buttons...

--
What is it, to enter data or to automaticly click *one* buttons

:)

Cor
 
T

Tom Shelton

Greg said:
Actually, the functionality is still there in VB.NET, but it has been moved
to the form itself.
Now every form "has a" default button property, whereby a button object can
be assigned to this property of the form.
In the form's properties go to the AcceptButton and CancelButton and choose
the required button from the dropdown lists.

Cheers,
Greg

Greg,

I realize that, I thought the OP was talking about default properties
like they existed in VB6 - you know:

Text1 = "Hello, World"

Where you didn't have to specify that it was really Text1.Text. It was
a simple misreading of the OP's post.
 
J

Jim Wooley

Huh?! I believe I am not the only one who is using the keyboard
What is it, to enter data or to automaticly click *one* buttons

Cor

It makes about as much sense as "clicking" a button by pressing the space
bar (when the button is highlighted).

Personally, I got started with heavy data input using the 10 key entry. If
it is an accounting system, or something that heavily uses numbers, it is
a pain to need to keep the left hand available for the tab key when it could
easily be flowing down a printed page keeping track of which line to enter.
(Ah the days of entering pages of hex codes from Compute! magazines...) Touch
typists can fly through a form much faster using the enter key to move between
fields than having to reach for the mouse all the time.
Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx
 
B

blugrasmaniac

The Default and Cancel properties have been removed from the Command
Button object, and have been implemented at the Form level. There is
an AcceptButton and CancelButton property on the Form object that
serves as the replacement.
 
G

Greg

Tom Shelton said:
Greg,

I realize that, I thought the OP was talking about default properties
like they existed in VB6 - you know:

Text1 = "Hello, World"

Where you didn't have to specify that it was really Text1.Text. It was
a simple misreading of the OP's post.

G'day Tom,

As the OP was talking about VB6, buttons and Enter as a default, I assumed
he meant how you could make the button default to an enter or esc press
which is now handled in VB.NET at the form level. LOL. Now I'm not even sure
what the OP was talking about :)

Cheers mate,
Greg.
 
T

Tom Shelton

Greg said:
G'day Tom,

As the OP was talking about VB6, buttons and Enter as a default, I assumed
he meant how you could make the button default to an enter or esc press
which is now handled in VB.NET at the form level. LOL. Now I'm not even sure
what the OP was talking about :)

Cheers mate,
Greg.

I think were right about it :)
 
C

Cor Ligthert [MVP]

Jim,

I agree if you have selected that button, but on the other hand, do I not
like those programs anymore that if I think to do a really enter. That enter
is in my idea still from terminals as the VT100 (Unix Terminals) or the 3270
on IBM mainframe, which sends a full screen.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top