How can I display info text in my dialoge form?

  • Thread starter Thread starter garyusenet
  • Start date Start date
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.
 
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
}
 
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 =/
 
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
 
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
 
Back
Top