Solved

Readonly textbox still has "I" insert bar icon

Posted on 2004-10-13
7
232 Views
Last Modified: 2010-04-23
Hello Folks:

I am putting together a game GUI which contains several textboxes abstracting dice.  As such, I want these textboxes to be read only - my program will be the only thing that writes to these text boxes.

I need these boxes to be enabled as I need to process mouse events that occure on these boxes.  Also, I do not want the text to be muted - which happens when enabled=false.  So I am running enabled = true, readonly = true.  I've tried locked = true and false - my problem is the same.

The problem is - when the program starts all the readonly textboxes are empty.  There is an "I" insert bar in the upper left most text box.  If I type - nothing is echoed in the box - so I am confident the box is read only.

How do I get rid of the "I" bar?

Thanks in advance!
0
Comment
Question by:jflanner
7 Comments
 
LVL 19

Expert Comment

by:arif_eqbal
ID: 12297049
Well the I icon will show whenever it has focus so you can avoid setting focus on the textboxes.

One way is to code the GotFocus of each textBox to set focus to some other control.

0
 
LVL 34

Expert Comment

by:flavo
ID: 12297072
use a label?
0
 
LVL 19

Expert Comment

by:arif_eqbal
ID: 12297096
another Idea is (Check it out if it really works I have not checcked it)

Define a custom Cursor instead of the I i.e. IBeam cursor, this cursor will be a blank image of same backColor as that of the TextBox then instead of the default Ibeam cursor set this new cursor for each TextBox using

TextBox1.Cursor=new Cursor("The new Cursor Path")

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 9

Accepted Solution

by:
checoo earned 250 total points
ID: 12297128
the easiest way is to have an additional textbox on the form. Set the height and width of this textbox to zero and set the focus  to this textbox when the form loads. SO when the form loads the user will not be able to see the "I" as this textbox will be practically invisible.
0
 

Author Comment

by:jflanner
ID: 12309690
checoo

I like the idea of moving the focus to a different component.  Now my really stupid question is - how do I do that?  I coded a load event handler:

    Private Sub BoggleGUI_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.textboxBoggleDie01.Focus()
    End Sub

But this does not seem to be working.  Any ideas???
0
 
LVL 19

Expert Comment

by:arif_eqbal
ID: 12316146
You need to use SetFocus method on getFocus of the textBox

see your user might click on the TextBox as well, in that case the focus will again shift to the TextBox so as I said earlier On the GotFocus event of the TextBox pass the focus to the dummy textBox

 Private Sub TextBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.GotFocus
        TextBox2.Focus()
End Sub

0
 
LVL 9

Expert Comment

by:checoo
ID: 12316197
suppose you have a text box with name txtDummy then in the form load event you can use the following statement

txtDummy.focus()
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
A short film showing how OnPage and Connectwise integration works.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now