1) Single Line Textbox can have a horizontal scrollbar-i READ FROM D BUK.
But no scrollbar is going to attached with single line textbox. Can a single line textBOX HAVE hor. scrollbar.

2)Selstart and SelLength
Private Sub Command1_Click()
Text1.SelText = UCase$(Text1.SelText)
Label1.Caption = Text1.SelStart
Label2.Caption = Text1.SelLength
End Sub

I have one textbox,two labels & one button.
Suppose i enter in textbox
sonia have done engineering.
If i select have & click on button then in label1 y 10 is displayed. According to me 7 is displayed. & in label2,nothing is displayed.In label2 acc. to me,4 is displayed.

Recommended Answers

All 9 Replies

In listbox property MultiSelect, what is the diff.b/w simple & Extended,cz in both the cases items are selected using CTRL+MOUSe.

1) Single Line Textbox can have a horizontal scrollbar-i READ FROM D BUK.
But no scrollbar is going to attached with single line textbox. Can a single line textBOX HAVE hor. scrollbar.

In normal condition -->NO. but can be implemented using API functions.

2)Selstart and SelLength
Private Sub Command1_Click()
Text1.SelText = UCase$(Text1.SelText)
Label1.Caption = Text1.SelStart
Label2.Caption = Text1.SelLength
End Sub

rectify the code as follows :-

Private Sub Command1_Click()
Label1.Caption = Text1.SelStart + 1
Label2.Caption = Trim(Text1.SelLength)
End Sub

now, there probably you can have a question, "why selstart+1?" this is because selstart takes value from 0. so to get WYSWYG position you need to add 1 to it. so. when select "have" from "sonia have done engineering, selstart will return 6 and then adding 1 will give exact value.

regards
Shouvik

In listbox property MultiSelect, what is the diff.b/w simple & Extended,cz in both the cases items are selected using CTRL+MOUSe.

Simple :
you can select non-adjacent items without pressing and holding the CTRL key. Just click on any item and it will be selected. again click on it to make it deselected. actually in this case CTRL key has no role.

Extended :
here you can't select multiple items just by clicking on it. to select multiple items you need press and hold the CTRL key and then click mouse on items to select or you can also press and hold the SHIFT key and click on items in order to select a continuous row of items.

regards
Shouvik

hi Shouvik ,
After doing the changes as suggested by you,Result is not appropariate.
Private Sub Command1_Click()
Text1.SelText = UCase$(Text1.SelText)
Label1.Caption = Text1.SelStart + 1
Label2.Caption = Trim(Text1.SelLength)
End Sub

In label1, 11 is displayed & in label2,still 0 is displayed.

hi Shouvik ,
After doing the changes as suggested by you,Result is not appropariate.
Private Sub Command1_Click()
Text1.SelText = UCase$(Text1.SelText)
Label1.Caption = Text1.SelStart + 1
Label2.Caption = Trim(Text1.SelLength)
End Sub

In label1, 11 is displayed & in label2,still 0 is displayed.

look out the following :

Private Sub Command1_Click()
Text1.SelText = UCase$(Text1.SelText)           --->not needed
Label1.Caption = Text1.SelStart + 1               ---> needed
Label2.Caption = Trim(Text1.SelLength)         ---> needed
End Sub

Plz sonia ....

dear,
why are you not accepting my invitation? plz do it. i'm very much excited to chat with you.

plz do it and come online tonight after 10. i'll be waiting only for you.
PLZ DEAR MUJHE AUR MAAT RULAO!!!!


shouvik

I have already accept ur invitation on orkut.

May I Know why do we use Trim() function in the following line
Label2.Caption = Trim(Text1.SelLength)
It is not needed i think so.

yes, u r right. though it is not needed actually but its better to use it. it will truncate all trailing spaces before n after your text if you have accidentally put it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.