How can I display info text in my dialoge form?

G

garyusenet

I want to display some informational text in a dialog something along
the lines of 'enter your text in the below box and press OK to save, or
Cancel to exit'.

I'm using a textbox to display this is that the right way to do it? The
user doesn't enter text into this, it's just informational so I wasn't
sure if textbox was best?

Problem with the textbox is when the form loads (a) it's highlighted in
blue, and (b) the user can click and get a cursor inside it. I've found
the readonly property but this doesn't stop the cursor from being able
to appear inside the text...

If textbox is the right control to use for this, how do i stop people
from being able to click into the text?

Thanks,

Gary.
 
C

Cerebrus

Hi Gary,

If the text is just for information, and the button choices are limited
to OK and Cancel, why don't you use an InputBox ?

string Result = "";
Result = InputBox("Enter your text in the below box and press OK to
save, or Cancel to exit", "Text Entry", "")
if (Result != "")
{
// Do something with the entered text
}
 
G

garyusenet

I tried your solution but it didn't work and generated an error... I
had a look on the internet and apparently there's no inputBox in dot
net =/
 
S

scott blood

I had a look on the internet and apparently there's no inputBox in dot
net =/

This is not strictly true, there is an InputBox function in VB.net, but not
c#

Regards
Scott Blood
C# Developer
 
C

Chris Dunaway

Add your text, placing \r\n where you need line breaks. You can also
set AutoSize to false if you want to size the lable manually
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top