|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Help with SendMessage API callsHi all,
Could someone provide a link to working code examples for implementing these Sendmessage API calls in VB.NET ?? EM_GETLINECOUNT EM_GETLINE EM_LINELENGTH EM_LINEINDEX I want to use these to get info from a multiline textbox. I can only find VB6 examples on the net. thanks in advance Steve Hi,
The textbox has a lines property I would use that instead of sendmessage For counter as integer = 1 to 50 textbox1.text &= "line number " & counter.tostring & controlchars.crlf next Dim strLines() as string = textbox1.lines trace.writeline(string.format("Textbox lines {0}", strlines.getubound(0))) For each sLine as string in strlines trace.writeline(sline) trace.writeline(string.format("Line length = {0}", sline.length)) next Ken -------------------- Show quoteHide quote "Steve" wrote: > Hi all, > > Could someone provide a link to working code examples for implementing these > Sendmessage API calls in VB.NET ?? > > EM_GETLINECOUNT > EM_GETLINE > EM_LINELENGTH > EM_LINEINDEX > > I want to use these to get info from a multiline textbox. I can only find > VB6 examples on the net. > > thanks in advance > Steve > > > If you can only find VB 6 examples then why don't you just convert them? It
would be very easy to do so. Ken is right about the number of lines etc. so, that part doesn't need to be converted. Are you using a RichTextBox or a standard TextBox by the way? Just out of interest. Thankyou both,
I have now managed to convert the VB6 code with the help of a few google searches etc. It's all working fine now. I have zero VB6 experience and only slightly more vb.net experience, and this is my first use of API calls :P The change from 32bit to 64bit for long ints was what caught me in the end As for why I don't use the standard .lines property.. The lines property only splits up the text into separate strings when there are hard CR/LF's entered by the user. I want to get an array of strings respresenting the text as it appears in the box, with any wrapped lines treated as separate strings. ie if I type "hello world this is a test" and the textbox wraps it over 2 lines, the .lines property will just return a single-element array with that one full string. The API EM_GETLINE call returns 2 strings of "hello world" and "this is a test" just as it appears in the box I want it this way so I can easily dump the contents of the textbox to a label printer as ascii thankyou both again Steve
Loopy over loops
REALbasic 5.5 free to VB6 Users Untili March 31 2005 From VB.NET to Delphi7 convert. looking for CPU-specific developer's benchmarking How to Prevent Flicker when Updating ListView e.Cancel = True in MDI Child Closing event Tabcontrol tabpagebutton orientation List View question Searching for strings inheritance and shared |
|||||||||||||||||||||||