472,371 Members | 1,412 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,371 software developers and data experts.

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 8601
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
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
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
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
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
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
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
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
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
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...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

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.