473,513 Members | 2,661 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SelStart in Large Textbox

Hi,

Is there a way to use the SelStart functionality in a textbox that has
more than 32,767 characters in it, when the cursor is beyond the
32,767th characterz?

SelStart is an integer, and it wraps around to negative numbers when
going beyond this upper limit.

Thanks,
Oren

Nov 13 '05 #1
6 8778
THis came up a while ago. You will have to use the API's to send
amessage to the textbox directly. THere is a thread here on this
subject:

http://groups-beta.google.com/group/...s.formscoding/
browse_frm/thread/ebd71aa8ff5b320a/5ce723032a342049?q=lebans+selstart+-E
CKANKAR&rnum=5&hl=en#5ce723032a342049

Post back if you need some help with the API declarations.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Oren" <or**@gdblegal.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
Hi,

Is there a way to use the SelStart functionality in a textbox that has
more than 32,767 characters in it, when the cursor is beyond the
32,767th characterz?

SelStart is an integer, and it wraps around to negative numbers when
going beyond this upper limit.

Thanks,
Oren


Nov 13 '05 #2
Hi Stephen,

Thanks for your advice. Have been under the weather, and so the project
I'm working on was on hold...

Please give some tips regarding the API declarations. How to find where
the cursor is in the textbox and how to set this value when it's beyond
the 32767th character.

All the best,
Oren
-------------

Stephen Lebans wrote:
THis came up a while ago. You will have to use the API's to send
amessage to the textbox directly. THere is a thread here on this
subject:

http://groups-beta.google.com/group/...s.formscoding/ browse_frm/thread/ebd71aa8ff5b320a/5ce723032a342049?q=lebans+selstart+-E CKANKAR&rnum=5&hl=en#5ce723032a342049

Post back if you need some help with the API declarations.


Nov 13 '05 #3
Hi Stephen,

Thanks for your advice. Have been under the weather, and so the project
I'm working on was on hold...

Please give some tips regarding the API declarations. How to find where
the cursor is in the textbox and how to set this value when it's beyond
the 32767th character.

All the best,
Oren
-------------

Stephen Lebans wrote:
THis came up a while ago. You will have to use the API's to send
amessage to the textbox directly. THere is a thread here on this
subject:

http://groups-beta.google.com/group/...s.formscoding/ browse_frm/thread/ebd71aa8ff5b320a/5ce723032a342049?q=lebans+selstart+-E CKANKAR&rnum=5&hl=en#5ce723032a342049

Post back if you need some help with the API declarations.


Nov 13 '05 #4
Oren what do you have so far?

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Oren" <or**@gdblegal.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hi Stephen,

Thanks for your advice. Have been under the weather, and so the project I'm working on was on hold...

Please give some tips regarding the API declarations. How to find where the cursor is in the textbox and how to set this value when it's beyond the 32767th character.

All the best,
Oren
-------------

Stephen Lebans wrote:
THis came up a while ago. You will have to use the API's to send
amessage to the textbox directly. THere is a thread here on this
subject:

http://groups-beta.google.com/group/...s.formscoding/

browse_frm/thread/ebd71aa8ff5b320a/5ce723032a342049?q=lebans+selstart+-E
CKANKAR&rnum=5&hl=en#5ce723032a342049

Post back if you need some help with the API declarations.


Nov 13 '05 #5
Stephen -

I'm quite unfamiliar with API declarations. Up until now, I've been
using the selStart property of a textbox to find/set the location of a
cursor in a textbox.

Oren

Nov 13 '05 #6
This code was tested on a form with a CommandButton, Unbound TextBox and
a TextBox bound to a Memo field. You can figure out the names of the
controls from the code:

When you are sending the EM_GETSEL message you are sending the variables
address(ByREF) so that the API can return the Selstart and SelEnd values
back to you.

When you are sending the EM_SETSEL message you are sending the variables
actual values(ByVal) since you are sending not receiving values.
Private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" _
(ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByRef wParam As Long, _
ByRef lParam As Long) As Long

Private Declare Function GetFocus Lib "user32" () As Long
Private Const EM_GETSEL = &HB0
Private Const EM_SETSEL = &HB1
Private Const EM_GETLINECOUNT = &HBA
Private Const EM_LINEINDEX = &HBB
Private Const EM_LINELENGTH = &HC1
Private Const EM_LINEFROMCHAR = &HC9

Private Sub testmemo_Click()
Dim lCurPos As Long
Dim hWnd As Long

' Start and End of current selection
Dim lStart As Long, lEnd As Long

' The TextBox control MUST HAVE THE FOCUS
Me.testmemo.SetFocus
' Get the hWnd of the Active window
hWnd = GetFocus

'get the character position of the cursor
Call SendMessage(hWnd, EM_GETSEL, lStart, lEnd)
Me.txtSelStart.Value = "Start:" & lStart & vbCrLf & "End:" & lEnd
End Sub

Private Sub cmdSelStart_Click()
On Error GoTo Err_cmdSelStart_Click

Dim lCurPos As Long
Dim hWnd As Long

' Start and End of current selection
Dim lStart As Long, lEnd As Long

' The TextBox control MUST HAVE THE FOCUS
Me.testmemo.SetFocus
' Get the hWnd of the Active window
hWnd = GetFocus

lStart = IIf(CLng(Me.txtSelStart.Value > -1), Me.txtSelStart.Value, 0)
'Set the character position of the cursor
Call SendMessage(hWnd, EM_SETSEL, ByVal lStart, ByVal lStart + 0)

Exit_cmdSelStart_Click:
Exit Sub

Err_cmdSelStart_Click:
MsgBox Err.Description
Resume Exit_cmdSelStart_Click

End Sub

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Oren" <or**@gdblegal.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Stephen -

I'm quite unfamiliar with API declarations. Up until now, I've been
using the selStart property of a textbox to find/set the location of a
cursor in a textbox.

Oren


Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2627
by: Mike | last post by:
My users have to select an value from a fixed selection of values. The obvious choice of control for such a requirement is to use a <select> (i.e. a combo box). My problem is that sometimes,...
1
6612
by: Hank | last post by:
Hello, There are many threads on this subject but I can't find the answer for my particular situation in Access 2000. I have a populated combo box that my users would like to work as a "Smart...
2
5094
by: Dennis C. Drumm | last post by:
What is the best way to add several pages of text to a readonly TextBox? The text does not change and was created in a Word rtf document but could as easly be put in a ASCII text file. Can this be...
3
2068
by: Hai Nguyen | last post by:
I have a large amount of text want to insert into a textbox. I would like to know how I can do that? Thanks Both by design time and running time
2
1152
by: Papa.Coen | last post by:
I try to submit a large text in a textbox (22k+ chars) and all I get is a blank page. This happened after adding a few lines to a text that was 'accepted' before. Shorter (tested : 20 chars)...
1
1300
by: J.S. | last post by:
I have a VB.Net Windows application that takes values inserted into textboxes in a windows form and inserts them into various parts of a large block of code. It concatenate the code blocks and the...
5
2726
by: debbie | last post by:
I have three combo boxes on a subform. I have tried setting them up so that when the user clicks in the combo box the curser moves to the left. I have searched the posts and can find nothing that...
13
2783
by: JJ | last post by:
I have a need to input a large tab delimited text file, which I will parse to check it has the expected columns, before allowing the user to submit it to the database. The user may paste the file...
2
2864
by: =?Utf-8?B?SC5CLg==?= | last post by:
Hi, In the past, I was using a MFC CEdit control to display logged data (A lot of Data). The control seems to have virtually no limit. Now, I'm using a .Net TextBox. When I reach about 32768...
0
7157
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7379
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7535
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5682
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5084
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1591
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.