473,499 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Default button

cj
Here's an easy one, I hope. How do I make button1, which I put on this
form from the toolbox, the default button on the form?

I thought it used to be a property in the properties window called
default. It's not there now. I found in the help index an isdefault
property and tried to set it in code but it doesn't show up in the list
when I type button1.isdef
Dec 21 '05 #1
10 4791
It is now a property of the Form itself. Look for the AcceptButton and
CancelButton properties.

Greg

"cj" <cj@nospam.nospam> wrote in message
news:ud**************@tk2msftngp13.phx.gbl...
Here's an easy one, I hope. How do I make button1, which I put on this
form from the toolbox, the default button on the form?

I thought it used to be a property in the properties window called
default. It's not there now. I found in the help index an isdefault
property and tried to set it in code but it doesn't show up in the list
when I type button1.isdef

Dec 21 '05 #2
cj
I looked and if, in the form1_load event, I type form1. acceptbutton
doesn't come up. If I type me. acceptbutton appears. Don't both refer
to the same form? I also tried activeform. and acceptbutton is there
too. What's different in that?

BTW, while I was waiting for a reply I found Button1.NotifyDefault(True)
but it doesn't work. What is it supposed to do? I didn't understand
the help.

Thanks

Greg Burns wrote:
It is now a property of the Form itself. Look for the AcceptButton and
CancelButton properties.

Greg

"cj" <cj@nospam.nospam> wrote in message
news:ud**************@tk2msftngp13.phx.gbl...
Here's an easy one, I hope. How do I make button1, which I put on this
form from the toolbox, the default button on the form?

I thought it used to be a property in the properties window called
default. It's not there now. I found in the help index an isdefault
property and tried to set it in code but it doesn't show up in the list
when I type button1.isdef


Dec 21 '05 #3
Now you're making an easy question hard! :)

"cj" <cj@nospam.nospam> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I looked and if, in the form1_load event, I type form1. acceptbutton
doesn't come up. If I type me. acceptbutton appears. Don't both refer to
the same form? I also tried activeform. and acceptbutton is there too.
What's different in that?

BTW, while I was waiting for a reply I found Button1.NotifyDefault(True)
but it doesn't work. What is it supposed to do? I didn't understand the
help.

Thanks

Greg Burns wrote:
It is now a property of the Form itself. Look for the AcceptButton and
CancelButton properties.

Greg

"cj" <cj@nospam.nospam> wrote in message
news:ud**************@tk2msftngp13.phx.gbl...
Here's an easy one, I hope. How do I make button1, which I put on this
form from the toolbox, the default button on the form?

I thought it used to be a property in the properties window called
default. It's not there now. I found in the help index an isdefault
property and tried to set it in code but it doesn't show up in the list
when I type button1.isdef



Dec 21 '05 #4
Your form1 is the class type, whereas Me is an instance of the form1 class.

I assume the properties and methods you see when you form1 are the shared
properites/methods of the class only.

I'm not sure why you would want to use NotifyDefault, but I gives a button
the "look" of being the default without really making it so.

Greg

"Greg Burns" <bl*******@newsgroups.nospam> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Now you're making an easy question hard! :)

"cj" <cj@nospam.nospam> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I looked and if, in the form1_load event, I type form1. acceptbutton
doesn't come up. If I type me. acceptbutton appears. Don't both refer to
the same form? I also tried activeform. and acceptbutton is there too.
What's different in that?

BTW, while I was waiting for a reply I found Button1.NotifyDefault(True)
but it doesn't work. What is it supposed to do? I didn't understand the
help.

Thanks

Greg Burns wrote:
It is now a property of the Form itself. Look for the AcceptButton and
CancelButton properties.

Greg

"cj" <cj@nospam.nospam> wrote in message
news:ud**************@tk2msftngp13.phx.gbl...

Here's an easy one, I hope. How do I make button1, which I put on this
form from the toolbox, the default button on the form?

I thought it used to be a property in the properties window called
default. It's not there now. I found in the help index an isdefault
property and tried to set it in code but it doesn't show up in the list
when I type button1.isdef

Dec 21 '05 #5
cj

Your right, I was making an easy question hard wasn't I. Sorry, but
thanks for the input. Ok, I guess classes and instances are still a bit
fuzzy to me as I thought form1 was an instance of the form class. Don't
worry about it, I'll pick it up as I go. As for NotifyDefault, Humm, I
guess it would be useful if you want to confuse your users. Or maybe
Microsoft wanted to confuse me. Er, I mean me as in me or is me an
instance of I? Darn it, where is my medication!

Greg Burns wrote:
Your form1 is the class type, whereas Me is an instance of the form1 class.

I assume the properties and methods you see when you form1 are the shared
properites/methods of the class only.

I'm not sure why you would want to use NotifyDefault, but I gives a button
the "look" of being the default without really making it so.

Greg

"Greg Burns" <bl*******@newsgroups.nospam> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Now you're making an easy question hard! :)

"cj" <cj@nospam.nospam> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl.. .
I looked and if, in the form1_load event, I type form1. acceptbutton
doesn't come up. If I type me. acceptbutton appears. Don't both refer to
the same form? I also tried activeform. and acceptbutton is there too.
What's different in that?

BTW, while I was waiting for a reply I found Button1.NotifyDefault(True)
but it doesn't work. What is it supposed to do? I didn't understand the
help.

Thanks

Greg Burns wrote:

It is now a property of the Form itself. Look for the AcceptButton and
CancelButton properties.

Greg

"cj" <cj@nospam.nospam> wrote in message
news:ud**************@tk2msftngp13.phx.gbl.. .
>Here's an easy one, I hope. How do I make button1, which I put on this
>form from the toolbox, the default button on the form?
>
>I thought it used to be a property in the properties window called
>default. It's not there now. I found in the help index an isdefault
>property and tried to set it in code but it doesn't show up in the list
>when I type button1.isdef


Dec 21 '05 #6
I created a small sample project just now, and it seems
that setting the TabIndex property of the buttom to 0
is sufficient to make the button the default item on the form.

That is ofcourse, until your user presses tab, but that's
true anyway...

Let us know if that works for your situation,
chrisj

"cj" <cj@nospam.nospam> wrote in message
news:ud**************@tk2msftngp13.phx.gbl...
Here's an easy one, I hope. How do I make button1, which I put on this
form from the toolbox, the default button on the form?

I thought it used to be a property in the properties window called
default. It's not there now. I found in the help index an isdefault
property and tried to set it in code but it doesn't show up in the list
when I type button1.isdef

Dec 21 '05 #7
Using the AcceptButton property is important if you want to write code like
this:

Dim f As New Form1
Dim r As Windows.Forms.DialogResult = f.ShowDialog

If r = DialogResult.OK Then
' do something
End If

Greg

"Chris Johnson" <ra*****@gmail.com> wrote in message
news:Or**************@TK2MSFTNGP15.phx.gbl...
I created a small sample project just now, and it seems
that setting the TabIndex property of the buttom to 0
is sufficient to make the button the default item on the form.

That is ofcourse, until your user presses tab, but that's
true anyway...

Let us know if that works for your situation,
chrisj

"cj" <cj@nospam.nospam> wrote in message
news:ud**************@tk2msftngp13.phx.gbl...
Here's an easy one, I hope. How do I make button1, which I put on this
form from the toolbox, the default button on the form?

I thought it used to be a property in the properties window called
default. It's not there now. I found in the help index an isdefault
property and tried to set it in code but it doesn't show up in the list
when I type button1.isdef


Dec 21 '05 #8
Hi

Form1 is a derived class from Form.
And then we use
Dim fm as Form1
fm is a instance

As for NotifyDefault, based on the MSDN, it should be called by the parent
form and we should use AcceptButton to assign a default button.

This method is called by the parent form to notify the Button that it
should be set as the default button and to allow it to adjust its
appearance accordingly. Typically, a button that is the default button for
a form has a thicker border than other buttons on the form.

Calling the NotifyDefault method only draws the button as a default button;
it does not change its behavior. To make the button behave like a default
button, it must be assigned to the AcceptButton property of the Form.


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Dec 22 '05 #9
cj
That's a fairly simple solution and I'm not checking results like Greg
is talking about. Neverless I'm setting acceptbutton because I set
focus to a text box when the form loads and I'd like the button's click
event to run regardless of what control the user is on if the user hits
enter (er. I should note this is the only button on the form).
Chris Johnson wrote:
I created a small sample project just now, and it seems
that setting the TabIndex property of the buttom to 0
is sufficient to make the button the default item on the form.

That is ofcourse, until your user presses tab, but that's
true anyway...

Let us know if that works for your situation,
chrisj

"cj" <cj@nospam.nospam> wrote in message
news:ud**************@tk2msftngp13.phx.gbl...
Here's an easy one, I hope. How do I make button1, which I put on this
form from the toolbox, the default button on the form?

I thought it used to be a property in the properties window called
default. It's not there now. I found in the help index an isdefault
property and tried to set it in code but it doesn't show up in the list
when I type button1.isdef


Dec 22 '05 #10
Hi

Thanks for your input!
If you still have any concern, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Dec 26 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6377
by: Billy Jacobs | last post by:
Is there a way to make a button on a web form the default button so that when the user hits the enter button the code for that button executes? I have a web page Login.aspx where I have only 1...
0
1853
by: Shixx | last post by:
Hello, I have problem in my web application and my web form. I have 5-6 buttons (web controls) and when I have focus on some text box, always one button becomes default and got focus, and after I...
3
6711
by: Marty McFly | last post by:
Hello, I have a control class that inherits from System.Web.UI.WebControls.Button. When I drag this control from the "My User Controls" tab in the toolbox onto the form, I want it to reflect the...
5
5403
by: Wonder | last post by:
How can I create or use the msgobx to show a message without a default button. The user has explicity to click on the button, so the msgbox closes it. Thanks,
3
3560
by: Rick Brandt | last post by:
I am using some buttons to hide/show various divs and am changing the style of the button to indicate which button's view is "active". My problem is that for the non-active buttons I want the...
3
1545
by: Anil Kumar Sharma | last post by:
Hello, I am working on C# using vs.net 2003. I have faced two interesting problems. 1. Dynamically setting Default Button: I created a form and used it in various contexts. On basis of the...
15
12512
by: simonoficina | last post by:
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...
1
2144
by: JJ | last post by:
What trouble I'm having setting default buttons on a page (with a master page). I got around doing it on a page basis by calling the SetWizardDefaultButton() routine from page load. Notice how...
4
2967
by: Whasigga | last post by:
Hi I've created a form that has 7 subforms. It is the same subform, bound to a table, just repeated. This form represents a week, and each subform is used to enter in data for each day of the...
0
7131
marktang
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,...
0
7007
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...
1
6894
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...
0
5470
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4600
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...
0
3099
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...
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
297
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.