Hello..
I've been having some problems for a little while with this which I was
sure I would beat...hmmm.
Anyway, I have a form with two rich textboxes. One at the top which is
to display a concatenated summary, and one at the botton for making a
new entry.
When items are added in from the bottom box, I do this via a class
(call_detail.vb ):
code from the click event of the submit button
------------------------------------------------
Dim mycall_detail As New call_detail
mycall_detail.r eference = update_referenc e
mycall_detail.n arrative = SpellCheckRichT ext1.Rtf.ToStri ng
mycall_detail.a dd_narrative()
-------------------------------------------------
I then call the add_narrative function as so from the class
----------------------------------------
Public Function add_narrative()
Dim sqlcom As New SqlCommand
sqlcom.Connecti on = sqlcon
sqlcom.CommandT ype = CommandType.Sto redProcedure
sqlcom.CommandT ext = "add_narrat ive"
sqlcom.Paramete rs.Add("@in_cal l_reference", reference)
sqlcom.Paramete rs.Add("@in_nar rative", narrative)
sqlcom.Paramete rs.Add("@in_use r", System.Environm ent.UserName)
If sqlcon.State <> ConnectionState .Open Then sqlcon.Open()
sqlcom.ExecuteN onQuery()
End Function
----------------------------------------
This calls a SQL Stored proc: as so
------------------------------------------
dbo.add_narrati ve
@in_call_refere nce int,
@in_narrative text,
@in_user char(40)
AS
insert into call_details(
call_reference, narrative,enter ed_by,date_ente red)
values(@in_call _reference,@in_ narrative,@in_u ser,getdate()
----------------------------------------------
This seems to add the data into the narrative table fine. one of the
entries in the narrative.narra tive field contains:
{\rtf1\ansi\ans icpg1252\uc1\de ff0\stshfdbch0\ stshfloch0\stsh fhich0\stshfbi0 \deflang2057\de flangfe2057{\fo nttbl{\f0\froma n\fcharset0\fpr q2{\*\panose
020206030504050 20304}Times New Roman;} test
This is the output from the rtf.tostring of the lower rich text box.
I can read that data back into a string no problem, but getting it to
show as formatted rich text is where I'm having problems - it only ever
displays literally.
I use a function in my class called_populate memo:
---------------------------------------------
Public Function populate_memo()
' Lets use a sqldata reader to get our text properties!!!
Dim retval As String
Dim sqlcom As New SqlCommand
sqlcom.Connecti on = sqlcon
sqlcom.CommandT ype = CommandType.Sto redProcedure
sqlcom.CommandT ext = "get_verbose_na rratives"
sqlcom.Paramete rs.Add("@in_cal l", reference)
Dim narr_reader As SqlDataReader
If sqlcon.State <> ConnectionState .Open Then sqlcon.Open()
narr_reader = sqlcom.ExecuteR eader
C_memo = Nothing
While narr_reader.Rea d
memo += Trim(narr_reade r.GetString(2)) & " on " &
narr_reader.Get DateTime(1) & vbNewLine
memo += "----------------------------------------------" &
vbNewLine
memo += narr_reader.Get String(0)
memo += vbNewLine & vbNewLine
End While
End Function
-------------------------------------------------
This calls the following stored procedure:
---------------------------------------
dbo.get_verbose _narratives
@in_call int
as
SELECT narrative,date_ entered, entered_by
FROM call_details
WHERE (call_reference = @in_call)
ORDER BY narrative_id
--------------------------------------------
And finally here is the code I use when trying to pass the contents of
the "memo" property of my class into the upper rich text box.
------------------------------------------
Dim mycalldetail As New call_detail
mycalldetail.re ference = update_referenc e
mycalldetail.po pulate_memo()
MessageBox.Show (mycalldetail.m emo)
RichTextBox1.Ap pendText(mycall detail.memo)
--------------------------------------------
I'm presuming this is a cast / type issue of sorts as if I create a
richtext document called jc.rtf and call :
' RichTextBox1.Lo adFile("d:\jc.r tf")
instead of the appendtext line it works fine.
I toyed with the idea of creating temporary richtext files to read
from, but don't like that idea at all...
I know this is all a little vague, but can anyone throw any light on
this? Am I making a fundemental error?
Many Thanks :-)
JC 4 1744
This is because AppendText is an inherited method from TextBoxBase and has
not knowledge of the RTF. You will need to walk the string with selection
and re-establish the format. This seems rather naff to me actually, I cant
see any other way of doing it other than as you say use temporatr files.
If you do however want to walk the string, you are going to need to parse
the formatting . . .
If anyone has found a better way to do this I would like to see it.
--
OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me
Time flies when you don't know what you're doing
"JC - home" <jo**@johnclark .me.uk> wrote in message
news:10******** **************@ h37g2000oda.goo glegroups.com.. . Hello..
I've been having some problems for a little while with this which I was sure I would beat...hmmm.
Anyway, I have a form with two rich textboxes. One at the top which is to display a concatenated summary, and one at the botton for making a new entry.
When items are added in from the bottom box, I do this via a class (call_detail.vb ):
code from the click event of the submit button ------------------------------------------------
Dim mycall_detail As New call_detail
mycall_detail.r eference = update_referenc e mycall_detail.n arrative = SpellCheckRichT ext1.Rtf.ToStri ng
mycall_detail.a dd_narrative()
-------------------------------------------------
I then call the add_narrative function as so from the class
---------------------------------------- Public Function add_narrative()
Dim sqlcom As New SqlCommand sqlcom.Connecti on = sqlcon sqlcom.CommandT ype = CommandType.Sto redProcedure sqlcom.CommandT ext = "add_narrat ive" sqlcom.Paramete rs.Add("@in_cal l_reference", reference) sqlcom.Paramete rs.Add("@in_nar rative", narrative) sqlcom.Paramete rs.Add("@in_use r", System.Environm ent.UserName)
If sqlcon.State <> ConnectionState .Open Then sqlcon.Open()
sqlcom.ExecuteN onQuery()
End Function ----------------------------------------
This calls a SQL Stored proc: as so
------------------------------------------ dbo.add_narrati ve
@in_call_refere nce int, @in_narrative text, @in_user char(40)
AS
insert into call_details(
call_reference, narrative,enter ed_by,date_ente red)
values(@in_call _reference,@in_ narrative,@in_u ser,getdate() ----------------------------------------------
This seems to add the data into the narrative table fine. one of the entries in the narrative.narra tive field contains:
{\rtf1\ansi\ans icpg1252\uc1\de ff0\stshfdbch0\ stshfloch0\stsh fhich0\stshfbi0 \
deflang2057\def langfe2057{\fon ttbl{\f0\froman \fcharset0\fprq 2{\*\panose 020206030504050 20304}Times New Roman;} test
This is the output from the rtf.tostring of the lower rich text box.
I can read that data back into a string no problem, but getting it to show as formatted rich text is where I'm having problems - it only ever displays literally.
I use a function in my class called_populate memo:
--------------------------------------------- Public Function populate_memo()
' Lets use a sqldata reader to get our text properties!!!
Dim retval As String
Dim sqlcom As New SqlCommand sqlcom.Connecti on = sqlcon sqlcom.CommandT ype = CommandType.Sto redProcedure sqlcom.CommandT ext = "get_verbose_na rratives" sqlcom.Paramete rs.Add("@in_cal l", reference)
Dim narr_reader As SqlDataReader
If sqlcon.State <> ConnectionState .Open Then sqlcon.Open()
narr_reader = sqlcom.ExecuteR eader
C_memo = Nothing
While narr_reader.Rea d
memo += Trim(narr_reade r.GetString(2)) & " on " & narr_reader.Get DateTime(1) & vbNewLine memo += "----------------------------------------------" & vbNewLine memo += narr_reader.Get String(0) memo += vbNewLine & vbNewLine
End While
End Function
-------------------------------------------------
This calls the following stored procedure:
---------------------------------------
dbo.get_verbose _narratives
@in_call int
as
SELECT narrative,date_ entered, entered_by FROM call_details WHERE (call_reference = @in_call) ORDER BY narrative_id
--------------------------------------------
And finally here is the code I use when trying to pass the contents of the "memo" property of my class into the upper rich text box.
------------------------------------------
Dim mycalldetail As New call_detail mycalldetail.re ference = update_referenc e mycalldetail.po pulate_memo()
MessageBox.Show (mycalldetail.m emo)
RichTextBox1.Ap pendText(mycall detail.memo)
--------------------------------------------
I'm presuming this is a cast / type issue of sorts as if I create a richtext document called jc.rtf and call :
' RichTextBox1.Lo adFile("d:\jc.r tf")
instead of the appendtext line it works fine. I toyed with the idea of creating temporary richtext files to read from, but don't like that idea at all...
I know this is all a little vague, but can anyone throw any light on this? Am I making a fundemental error?
Many Thanks :-)
JC
I guess writing a procedure to walk the string wouldn't be too
difficult, just time consuming on something that should be
straightforward .... I was thinking of being able to paste screenshots
into the rtf box as well though..... oh well!!! ;-)
Perhaps there is a custom control out there somewhere that will save me
the time on this one!
JC
As the upper text box is only intended to show RTF, anyone have any
suggestions on any other controls that would recognise the rtf format -
all clients will have msoffice XP installed...... .
Sorry to use this group as a dumping ground for my thoughts... I guess
I could create a crystal report (or other reporting tool as I really
don't like crystal that much) and have that interpret the text as
rtf....... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Lukas Thanei |
last post by:
Hi,
Im trying for 2 days to solve a problem but now Im on a point where all
ideas exhausted. Im writing a software to print out some cards containing
richtext and images.
To print the richtext im using an windows api call (Sendmessage
EM_FORMATRANGE -
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html/wnf_RichTextBox.asp).
Because I have to print background images, the richtext background should be
|
by: crjunk |
last post by:
I have a 3 table in my DataSet that I'm filling with data. After I've
filled these 3 tables, I'm then trying to run a query that will fill a
4th table in the DataSet with data from the three tables that are
already pouplated.
When my code tries to fill the 4th table, ReportData, I receive the
following error message: Invalid object name 'tmpPROJECTINFO'. Invalid
object name 'tmpContacts'. Invalid object name 'tmpRECEIVEREC'.
Can...
|
by: The One |
last post by:
Have created a form to pop up with 2 option I then wish to write the text that
is in the option button chose back to the original form using the code below but
it gives me an exception error so could any please help me.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim frm As Form1
Dim text As String
|
by: Gary Shell |
last post by:
I have a very ODD situation.
I have a RichTextBox and a button. In the button click event I have the
following:
me.richtextbox1.SelectedText="test"
Assuming I start with "aaaabbbbcccc" in the richtext box and I place the
caret between the a and b and hit the button. I get "aaaatestbbbbcccc" as
expected. Then I click between the b and the c and hit the button I get:
|
by: james |
last post by:
Hi, I am loading a CSV file ( Comma Seperated Value) into a Richtext box. I have a routine that splits the data up when it hits
the "," and then copies the results into a listbox. The data also has some different characters in it that I am trying to
remove. The small a with two dots over it and the small y with two dots over it. Here is my code so far to remove the small y:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal...
| |
by: ste |
last post by:
Hi there,
I'm trying to query a MySQL database (containing image data) and to output
the results in a HTML table of 3 columns wide (and however many rows it
takes) in order to create a basic thumbnail gallery.
I can query and output the data as a single column table, but I'm having
problems filling up a 3 column table (with different images, looping
continuously until the end).
|
by: Tomo |
last post by:
How to use RichText in ASP.NET application. I need to make web page where
user can write some text, click save and than this content must be saved as
html content. Can I find some richtext control or I need to use javascript?
|
by: giddy |
last post by:
hi ,
i made a little RtfEncapsulator. Its a class thats called RichText ,
it has an RtfElementCollection which takes any class that exposes the
IRtfElement interface.
I managed to make an RtfTextElement which works really well.
So to add text this has to be done:
Code:
|
by: Soulless |
last post by:
Hi, I am going crazy trying to resolve a stupid issue. I have a RTB
control and created a method to accept a string and (hopefully) set
the font and size and alignment... Here is the method:
private void AddToRTFReport(string asText, object aoColor,
string asFont,object aoFontStyle, int aiSize, object aoAlignment)
{
int liLen = rtb1.Text.Length;
if (liLen <= 0)
{
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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,...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |