Hi all just a quick question, what code do I use to make user input of RETURN(enter button) defaulting to an OK button on a windows form? thanks for your time.

In form properties you will find property called "Accept button" set it to the button you need to be pressed if user press "Enter"

commented: Thanks for the help +1

aaah thanks very much thats great. Not too difficult to find either lol

double click that text box and write this code


this.AcceptButton= button1 (name of button you want as accept button)

shahab Qureshi

commented: Try not to resurrect 2 year old threads. +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.