Solved

uneditable textbox

Posted on 2004-04-07
13
894 Views
Last Modified: 2007-12-19
hi how can i make a textbox uneditable, i want it to still look normal eg same colour text and not greyed out etc but i dont want the user to be able to change the text in it, the text can be chande programatically.
0
Comment
Question by:--laser--
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 2
13 Comments
 
LVL 19

Expert Comment

by:BrianGEFF719
ID: 10779772
on the Design, right click the text box and set the property value for "ReadOnly" to True.



-Brian
0
 
LVL 19

Accepted Solution

by:
BrianGEFF719 earned 70 total points
ID: 10779774
I'm sorry


Its "Locked" to true.

Change the property value for Locked to True.



-Brian
0
 
LVL 4

Author Comment

by:--laser--
ID: 10780339
yeh thanks, i cant believe i forgot about that option, it is simple. i had to go out and i quickly looked for it, i must of overlooked it.
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 4

Author Comment

by:--laser--
ID: 10780350
one more thing, since that was so simple can you tell me how to change the selection of a listview control

say i have 10 things in a listview control hello, goodbye, out, etc
if i wanted to select goodbye in code (not by clicking it) how would i do this

it is probably another simple thing!!!
0
 
LVL 4

Author Comment

by:--laser--
ID: 10780565
by the way i will raise points if you answer this
0
 
LVL 4

Author Comment

by:--laser--
ID: 10780636
dont worry i figured it out, thanks for the help before
0
 

Expert Comment

by:Halluzination
ID: 10780680
Yep, you overlooked something else very simple, laser.

Here's a way to do it:

First, when you add a new item to your list, make sure to define an index for that item or else you will have to work harder to select it.  Ex:

lstMain.Additem "Joe", 4

Then, if you wanted to make an array that contained all the name and index correspondants (If it is user entry) Or, if you have a defined amount of items in the list, just remember the index for each item and use it later in the code.  OK, to select any of them, you have to know the index number of which one you want to select and the command is simply:

lstMain.Selected(2) = True

Where 2 is the index number.


Hope this helps, Laser!
0
 
LVL 4

Author Comment

by:--laser--
ID: 10780914
i have a database with any number of records in it, they are all the names of the dvd movies that i have. when i search for them i can get the recordset to go to it easily but it dosn't show that i have it selected in the listview. i need to search for the name and have it selected in the listview.

MoviesLst.SelectedItem = FrmMain.MoviesLst.ListItems("ghost")

this dosnt work, it says "element not found"

if i change "ghost" to the index

eg.  MoviesLst.SelectedItem = FrmMain.MoviesLst.ListItems(7)

that corresponds to that movie it works but that isn't what i want
0
 

Expert Comment

by:Halluzination
ID: 10781078
Let me explain again,

If you search for it and SearchIndex is the Index number that corresponds to your search result, you would do
 
MoviesLst.Selected(SearchIndex) = True

That makes that movie and that movie only be selected.  Then, if you want it to appear at the top of your listbox, do

MoviesLst.TopIndex = SearchIndex

If this still doesn't work, maybe you could explain your problem more thoroughly?
0
 
LVL 4

Author Comment

by:--laser--
ID: 10781112
ok say i have 5 items in the listview they are ghost, gladiator, star wars 2, the italian job and shrek. if i want to highlight gladiator how do i do this. i want to highlight it without clicking it.
0
 

Expert Comment

by:Halluzination
ID: 10781131
First you have to know the index number to it.

If you don't assign the index when you add it to the list, then it is in consecutive order starting at the top at 0 and getting larger as you go down the list.  But, if you are going to make a search to find it, you should assign an index number to each movie when you add it to the list and store this in an array with the movie name so that you can access both easily.  The syntax is: MoviesLst.additem "ItemNameHere", indexnumberhere
The indexnumber is optional, but you can keep up with it if you assign it yourself.
0
 
LVL 4

Author Comment

by:--laser--
ID: 10781172
hang on a sec, i have a listview not a listbox, your code suits a listbox
0
 

Expert Comment

by:Halluzination
ID: 10781403
gotcha.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month2 days, 18 hours left to enroll

622 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