473,785 Members | 2,824 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 8855
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/ebd71aa8ff5b320 a/5ce723032a34204 9?q=lebans+sels tart+-E
CKANKAR&rnum=5& hl=en#5ce723032 a342049

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******** *************@g 14g2000cwa.goog legroups.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/ebd71aa8ff5b320 a/5ce723032a34204 9?q=lebans+sels tart+-E CKANKAR&rnum=5& hl=en#5ce723032 a342049

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/ebd71aa8ff5b320 a/5ce723032a34204 9?q=lebans+sels tart+-E CKANKAR&rnum=5& hl=en#5ce723032 a342049

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.goo glegroups.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/ebd71aa8ff5b320 a/5ce723032a34204 9?q=lebans+sels tart+-E
CKANKAR&rnum=5& hl=en#5ce723032 a342049

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 "SendMessag eA" _
(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.Set Focus
' Get the hWnd of the Active window
hWnd = GetFocus

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

Private Sub cmdSelStart_Cli ck()
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.Set Focus
' Get the hWnd of the Active window
hWnd = GetFocus

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

Exit_cmdSelStar t_Click:
Exit Sub

Err_cmdSelStart _Click:
MsgBox Err.Description
Resume Exit_cmdSelStar t_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.goo glegroups.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
2650
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, these combo boxes will have a *large* number of values. There could be any number of values in them from 5 to 5 million (unlikely it would be this large but possible). Obviously 5 million is far too much to populate a <select> control with. Does...
1
6655
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 Search". In other words, they want to start typing the entry they are after and have the combo box search down matching, not only the first letter, but all succesive letters. EXAMPLE: "B", "U", "L" separates "Bull Moose" from "Buckeye" This...
2
5110
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 done using a resource or something? Can TextBoxes be attached to data sources other than database objects? Thanks, Dennis
3
2089
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
1169
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) texts are accepted. Debugging does not even get near a page_load or textbox reading event handler. I use VS 2003 & .net 1.4x with IE 6.0.2900
1
1312
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 variables in the VB code and generates the output code in a large multi-line textbox. Is it possible to pull the code blocks from some text files for concatenating with the values of the variables? Also, is it possible to generate the output...
5
2736
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 answers my problem....no matter what I have tried....on click, set focus, got focus...one combo box works and the other two start one space from the left....now if the user tabs, of course they all work...and if you've clicked anywhere else on...
13
2838
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 into a textbox, or upload it (haven't decided yet). The problem I have is that the text file consists of around 3000 lines, and I want to display the formatted columns to the user before submitting it to the database (perhaps allowing them to...
2
2878
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 characters it doesn't take any more data. How can I change this.
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10090
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9949
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8971
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5380
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4050
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 we have to send another system
2
3645
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.