Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 132,270 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,133 people online right now. Registration is fast and FREE... Join Now!




Trouble With TextBox

 
Reply to this topicStart new topic

Trouble With TextBox, I am having trouble getting beyond the most basic properties of TextBo

WonderingWillie
post 6 Sep, 2008 - 06:18 PM
Post #1


New D.I.C Head

*
Joined: 6 Sep, 2008
Posts: 2

I am using Visual C# 2008 Express and Vista. Obviously I'm new to this type of programming.

Although I don't know how much this matters, I have a
- Form object containing a
- Tool Strip Container containing a
- Tool Strip Panel containing a
- Text Box.

(1) When I run the program, the Text Box has no outline until I mouse over it, at which time a thin blue frame appears. I'd like to see it have a frame from the start.

(2) Typing in the text box works fine except there is a "bonk" sound when I press the Enter key and more "bonk" sounds if I hold it down. I can't tell if there is one when I release the Enter key. When I do release the Enter key, the data I've typed is transmitted properly to my next object -- just as planned.

These are just annoying User inteface issues, but I'd really appreciate some clarity on how to fix them.

Thanks in advance for insights or even questions. Best,
User is offlineProfile CardPM

Go to the top of the page

gbertoli3
post 6 Sep, 2008 - 06:47 PM
Post #2


DIC at Heart + Code

Group Icon
Joined: 23 Jun, 2008
Posts: 1,026



Thanked 16 times

Dream Kudos: 950
My Contributions


1:
The thin blue line is how windows shows that the textbox has focus. Unfortunately you can not have that all the time.

2:
The bonk sound is because there is no accept button. Set the form's accept button to a button on your form, then it will not make a bonk sound.

Hope this helps
User is online!Profile CardPM

Go to the top of the page

jacobjordan
post 6 Sep, 2008 - 06:48 PM
Post #3


class Me : Perfection

Group Icon
Joined: 11 Jun, 2008
Posts: 1,105



Thanked 22 times

Dream Kudos: 1575
My Contributions


<polite>gbertoli, you just a little bit wrong</polite>

You cannot add a text box directly into a toolstripcontainer, so you left out that it is in a tool strip. Anyway, by changing the text boxes border style (in the properties window) you can select how the text boxes border will look. Setting it to FixedSingle should do what you want.

You are getting a "bonk" when you hit enter because the text box is set for one line only, so it "bonks" when you try to make a new like. To get around that, make a KeyDown event for your text box. In that, type
csharp

if (e.KeyCode == Keys.Enter) // the enter key was pressed
{
e.SuppressKeyPress = true; //gets rid of the "bonk"

/* do whatever the hell you want with the data in the
text box here */
}


This post has been edited by jacobjordan: 6 Sep, 2008 - 06:50 PM
User is offlineProfile CardPM

Go to the top of the page

gbertoli3
post 6 Sep, 2008 - 06:50 PM
Post #4


DIC at Heart + Code

Group Icon
Joined: 23 Jun, 2008
Posts: 1,026



Thanked 16 times

Dream Kudos: 950
My Contributions


Sorry I was wrong.

P.S. I love the <polite> part

This post has been edited by gbertoli3: 6 Sep, 2008 - 06:54 PM
User is online!Profile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/22/08 12:10AM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month