setfocus a textbox during formload - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

setfocus a textbox during formload

NitheeshNitheesh Posts: 7Member
Hi
I have a problem with setfocus in vb.net.

i have to set a text box to be focused on form load.

txtname.focus()

is what i have used.
But it is not working.

WHat else is the method.

Comments

  • PavlinIIPavlinII Posts: 404Member
    : Hi
    : I have a problem with setfocus in vb.net.
    :
    : i have to set a text box to be focused on form load.
    :
    : txtname.focus()
    :
    : is what i have used.
    : But it is not working.
    :
    : WHat else is the method.
    :
    Hi,
    set TabIndex of txtName during desing time to lowest value - 0.
    And change the currently focused textbox's tabindex to higner unused value..
    Control with lowest TabIndex will be focused.

    If you need to dynamically change witch control will have focus, you can change TabIndex in Page_Load, or use Page_Activated and make soma Is1st flag and set this only if it is 1st occurence of this event.
    But I guess that the first trick will solve your problem.

    [blue][b][italic][size=4]P[/size]avlin [size=4]II[/italic][/size][/b][/blue]

    [purple]Don't take life too seriously anyway you won't escape alive from it![/purple]


Sign In or Register to comment.