473,626 Members | 3,201 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 4809
It is now a property of the Form itself. Look for the AcceptButton and
CancelButton properties.

Greg

"cj" <cj@nospam.nosp am> wrote in message
news:ud******** ******@tk2msftn gp13.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.NotifyD efault(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.nosp am> wrote in message
news:ud******** ******@tk2msftn gp13.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.nosp am> wrote in message
news:%2******** ********@TK2MSF TNGP09.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.NotifyD efault(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.nosp am> wrote in message
news:ud******** ******@tk2msftn gp13.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*******@news groups.nospam> wrote in message
news:%2******** *******@TK2MSFT NGP11.phx.gbl.. .
Now you're making an easy question hard! :)

"cj" <cj@nospam.nosp am> wrote in message
news:%2******** ********@TK2MSF TNGP09.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.NotifyD efault(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.nosp am> wrote in message
news:ud******** ******@tk2msftn gp13.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*******@news groups.nospam> wrote in message
news:%2******** *******@TK2MSFT NGP11.phx.gbl.. .
Now you're making an easy question hard! :)

"cj" <cj@nospam.nosp am> wrote in message
news:%2****** **********@TK2M SFTNGP09.phx.gb l...
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.NotifyD efault(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
CancelButto n properties.

Greg

"cj" <cj@nospam.nosp am> wrote in message
news:ud**** **********@tk2m sftngp13.phx.gb l...
>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.nosp am> wrote in message
news:ud******** ******@tk2msftn gp13.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.D ialogResult = f.ShowDialog

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

Greg

"Chris Johnson" <ra*****@gmail. com> wrote in message
news:Or******** ******@TK2MSFTN GP15.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.nosp am> wrote in message
news:ud******** ******@tk2msftn gp13.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.nosp am> wrote in message
news:ud******** ******@tk2msftn gp13.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

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

Similar topics

1
6393
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 button on the form. When the user hits enter the button is clicked. I have a second page mycsepp.aspx which has an asp button and a link button. When I hit enter neither of the button click events are triggered. If I tab to one of them and
0
1861
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 write something in text box and press Enter I invoke that button method ?!?! But this is not button I want to be default. I set tab orders and nothing always that button becomes default when I am on some text box on web form. How can I set default...
3
6743
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 following default properties: Height = 32px, Width = 144px. I declare the Width property in my control as... \\\
5
5418
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
3581
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 default look. Once I change a button's style to something else what is the style setting to revert them back to this default? EX: Button starts at default.
3
1564
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 context, the panel of a form which contains various buttons , are shown or hides. Now at design time i set the default button property to one of button. But when the form object is created in different context and set visibilty of default
15
12531
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 property. Where is it? Or mabye change the other thing,No?Thanks ! Simon
1
2164
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 messy it looks because I could not find the required button any other way but by using the id it is given in the source code. I tried every combination of nested 'findcontrol' methods I could think of, but none worked??!! It seems to be...
4
2980
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 week. The main form has a combo box that must have a value selected before anything else can happen. Once that value is selected, the 7 subforms are enabled, and also one of the fields is populated with the value from the main form. These subforms also...
0
8265
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, 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...
0
8196
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,...
0
8705
Oralloy
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...
0
8504
tracyyun
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...
0
7193
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
isladogs
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...
0
4092
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...
0
4197
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2625
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 we have to send another system

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.