i want to focus the text box after the click in the textbox or heilight he border of textbox
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Ramchand RepalleRank #762 · 3K reputationPosted Jan 28, 2015, 12:45 AM EST
you can achieve by applying css styles for input textbox.
http://jsfiddle.net/ramchandr/ptdrwwz1/
The aforesaid Jsfiddle helps you to achieve that..
Thanks,
Ramchand
Afzaal Ahmad ZeeshanRank #60 · 27.6K reputationPosted Jan 28, 2015, 12:46 AM EST
Secondly, for us to work on it and help you out, you need to provide the code you're using and the framework you're using also matters, changing the border in ASP.NET is totally different as compared to changing the border in WPF or Win Forms etc. In ASP.NET you can use the CSS styling techniques to change the border of the TextBox (in HTML form it is an input element), whereas in WPF or Win Forms you need to change the parent property of the TextBox (that is the Border which wraps it).
Have a look at this MSDN link for more on this topic: https://msdn.microsoft.com/en-us/library/system.windows.controls.textbox(v=vs.110).aspx
Ameer Basha21 reputationPosted Jan 28, 2015, 2:08 AM EST
Textbox1.focus();
Karan Gupta28 reputationPosted Jan 28, 2015, 4:13 AM EST
Karan Gupta28 reputationPosted Jan 28, 2015, 4:18 AM EST
Indian Careers3 reputationPosted Jan 28, 2015, 4:36 AM EST
use the same code below
and don't forget to give tab index in order for the textboxes
code :
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
textBox1.Focus();
}
}
}