select and insert picture in RichTextBox
select and insert picture in RichTextBox
select and insert picture in RichTextBox
select and insert picture in RichTextBox
select and insert picture in RichTextBox
select and insert picture in RichTextBox select and insert picture in RichTextBox select and insert picture in RichTextBox select and insert picture in RichTextBox select and insert picture in RichTextBox select and insert picture in RichTextBox select and insert picture in RichTextBox select and insert picture in RichTextBox
select and insert picture in RichTextBox select and insert picture in RichTextBox
select and insert picture in RichTextBox
Go Back  Xtreme Visual Basic Talk > > > select and insert picture in RichTextBox


Reply
 
Thread Tools Display Modes
  #1  
Old 05-31-2014, 06:08 AM
Ashraf_ Ashraf_ is offline
Newcomer
 
Join Date: Mar 2012
Posts: 16
Unhappy select and insert picture in RichTextBox


hi,
i have a rich textbox and it contain a text, and i need to select the last line automatically by code. and i need to put a picture in the last line.
any idea to help me.

i use the below code :-

PHP Code:
 in module  

Option Explicit 
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long
    ByVal wMsg 
As LongByVal wParm As LongIParam As Any) As Long 
    
Public Const WM_PASTE = &H302 
    
Private Const EM_GETLINECOUNT = &HBA 


in button 

Dim LineCount 
As Long 
Clipboard
.Clear 
Clipboard
.SetData Image1.Picture 
SendMessage RichTextBox1
.hwndWM_PASTE0&, 0
this code is work but the picture come in the top( before text)

and i need to put it after the last line of text.

many thanks.
Reply With Quote
  #2  
Old 05-31-2014, 06:44 AM
Gruff's Avatar
Gruffselect and insert picture in RichTextBox Gruff is offline
Bald Mountain Survivor

Retired Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA - deceased
Posts: 6,440
Default

I would think that you should probably set the RTB cursor at the end of the text first.

BTW if you are going to post VB6 code then you should post it in the Legacy VB4,5,6 area.

Code:
Option Explicit Private Sub Command1_Click() Dim LineCount As Long With RichTextBox1 .SelStart = Len(.Text) .SelLength = 0 End With Clipboard.Clear Clipboard.SetData Image1.Picture SendMessage RichTextBox1.hwnd, WM_PASTE, 0&, 0& End Sub
__________________
Burn the land and boil the sea
You can't take the sky from me


~T
Reply With Quote
  #3  
Old 05-31-2014, 07:22 AM
Ashraf_ Ashraf_ is offline
Newcomer
 
Join Date: Mar 2012
Posts: 16
Default

thank you Mr. Gruff very much
its work very well .
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
select and insert picture in RichTextBox
select and insert picture in RichTextBox
select and insert picture in RichTextBox select and insert picture in RichTextBox
select and insert picture in RichTextBox
select and insert picture in RichTextBox
select and insert picture in RichTextBox select and insert picture in RichTextBox select and insert picture in RichTextBox select and insert picture in RichTextBox select and insert picture in RichTextBox select and insert picture in RichTextBox select and insert picture in RichTextBox
select and insert picture in RichTextBox
select and insert picture in RichTextBox
 
select and insert picture in RichTextBox
select and insert picture in RichTextBox
 
-->