Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Inserting Data Into Rich-Text File


Good Day

I have created an invoicing program in VB6 – MS-Access 2003. I have a form and using RichText control for the invoice, this one is for printing and creating a soft copy. Now the main reason why I when with a rich-text is to have the ability to email the invoice. I have another form for the email and the body of the email is using RichText control. The problem that I am having is exporting the invoice items into the rich-text file. My invoice form draws the data form another form that the user can pick the preson name and invoice number. This form uses a datagrid and Adodc ( I included some screen shots of it )


Code:

Private Sub Form_Load()

Set ConnDB = New ADODB.Connection
With ConnDB
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "Data Source=" & App.Path & "SpeedData.mdb;Persist Security Info=False"
.Open
End With

lblTemp1 = ViewPrintInvoice.lblInstaller.Caption
lbltemp2 = ViewPrintInvoice.lblInvoiceNum.Caption
Totals
LoadData

End Sub

Private Sub LoadData()
Dim Temp As String

Set rstOwner = New ADODB.Recordset

With rstOwner
.ActiveConnection = ConnDB
.CursorType = adOpenStatic
.LockType = adLockReadOnly
.Open "SELECT * FROM Owner"
End With

Set rstTax = New ADODB.Recordset

rtbInvoice.LoadFile App.Path & "TempInvoice.rtf"

Temp = rtbInvoice.TextRTF

Temp = Replace(Temp, "toDayDate", Space(0) & ViewPrintInvoice.lblDate.Caption)
Temp = Replace(Temp, "invX", Space(0) & ViewPrintInvoice.lblInvoiceNum.Caption)

Temp = Replace(Temp, "busNameX", Space(0) & rstOwner![BusName])
Temp = Replace(Temp, "ownerX", Space(0) & rstOwner![Name])
Temp = Replace(Temp, "addressX", Space(0) & rstOwner![Address])
Temp = Replace(Temp, "cityX", Space(0) & rstOwner![OCity])
Temp = Replace(Temp, "provX", Space(0) & rstOwner![Prov])
Temp = Replace(Temp, "postalX", Space(0) & rstOwner![PostalCode])
Temp = Replace(Temp, "phoneNumX", Space(0) & rstOwner![PhoneNum])
Temp = Replace(Temp, "faxX", Space(0) & rstOwner![FaxNum])

Temp = Replace(Temp, "busNameY", Space(0) & ViewPrintInvoice.lblBusName.Caption)
Temp = Replace(Temp, "installerY", Space(0) & ViewPrintInvoice.lblInstaller.Caption)
Temp = Replace(Temp, "addressY", Space(0) & ViewPrintInvoice.lblAddress.Caption)
Temp = Replace(Temp, "cityY", Space(0) & ViewPrintInvoice.lblCity.Caption)
Temp = Replace(Temp, "provY", Space(0) & ViewPrintInvoice.lblProv.Caption)
Temp = Replace(Temp, "postalY", Space(0) & ViewPrintInvoice.lblPostalCode.Caption)
Temp = Replace(Temp, "phoneNumY", Space(0) & ViewPrintInvoice.lblPhoneNum.Caption)

Temp = Replace(Temp, "gstY", Space(0) & newGst & "%")
Temp = Replace(Temp, "pstY", Space(0) & newPst & "%")

Temp = Replace(Temp, "gstX", Space(0) & varGst)
Temp = Replace(Temp, "pstX", Space(0) & varPst)
Temp = Replace(Temp, "subTotalX", Space(0) & varSubTotal)
Temp = Replace(Temp, "totalX", Space(0) & varTotal)

rtbInvoice.TextRTF = Temp
rtbInvoice.SelStart = 1

Me.rtbInvoice.SaveFile App.Path & "Invoices" & ViewPrintInvoice.lblInstaller.Caption & " " & ViewPrintInvoice.lblInvoiceNum.Caption & ".rtf"


End Sub




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Inserting Data Into A Text File
Is there a way to "insert" a line of data (string variable) at the top of a text file that already contains data. I have a text file with over 500 lines of customer information and I need to insert 1 line at the top of the file that is non customer information.

Inserting My Own Text Into Rich Text Control Without Losing Previous Formats
Dears

I'd like to paste my own text into that control, but after attched code will be executed I'll get text in normal "text" style without changed fonts etc. How it needs to be done?

Dim Position As Long
Dim Buffer_Before As String
Dim Buffer_After As String

    Position = RichTextBox3.SelStart 'the place to insert desired text
    
    If RichTextBox3.SelLength > 1 Then
       RichTextBox3.SelLength = 1
    End If

    RichTextBox3.SelStart = 0
    RichTextBox3.SelLength = Position
    Buffer_Before = RichTextBox3.SelText 'first part of the text

    RichTextBox3.SelStart = Position
    RichTextBox3.SelLength = Len(RichTextBox3.Text) - Position
    Buffer_After = RichTextBox3.SelText 'second part
    RichTextBox3.TextRTF = Buffer_Before & "##Place##" & Buffer_After

Inserting Textbox Data Into A Text File
Hi Everyone

I have 16 textboxes and am trying to loop through all of them to make the code simple, and insert the data into a text file.
I have most of the code right, but I cant get the write command to see that the string is a textbox name.

My text boxes are 'AddToClientRecord1, AddToClientRecord2,....AddToClientRecord16.

The code which isn't working is

Open "C:Documents and SettingsMeezlesMy DocumentsOur DocumentsNomesHibiscus MassageClient Records" & ClientLastName & "," & ClientFirstName & ".txt" For Append As #1
AddDetails2 = 0
Do While AddDetails2 <= 15
AddDetails2 = AddDetails2 + 1
AddDetails3 = "AddToClientRecord" & AddDetails2 & ".Text"
AddDetails4 = AddDetails3
If AddDetails4 = "" Then
Else
Write #1, AddDetails4
End If
Loop

AddDetails2 is a integer, AddDetails3 is a string, AddDetails4 is a string.

The files open and close fine, but Instead of inserting the data, it simply puts
"AddToClientRecord1.text"
"AddToClientRecord2.text"......
"AddToClientRecord16.text"

Any help would be great.

Dave

Inserting Pictures In A Rich Text Box
I want to be able to drag a moveable image from a form into a rich text box, then the rich text box will have a copy of whatever image was dragged into it. Can somebody help me figure out how to set this up?

Inserting Pictures In Rich Text Box
I want to insert a Picture (That is already on my form on Picture Box/Image List) into Rich Text Box at a position (i.e seltext)
can anyone tell me how can i do that By Code (I dont want to do it by Drag & Drop)

Inserting Into Rich Text Box Question
I am using the following for a keyboard shortcut in a rich text box.  The code is in the form's keypress event and it looks for keyboard shortcuts for different users.  If it finds one, it gets the actual text for the shortcut and inserts it into the rich text box.  The problem is that it also inserts the keystroke.  For instance, if shift+A is my shortcut, it will insert the text "Athisismytext".  How can I eliminate the actual keystroke from appearing on the box?

Spell1.SelStart = intCursorloc
                Spell1.SelLength = 0
                Spell1.SelTextRTF = funGetmacrobyshortcut(strMyname, intShortcuts(V))
                Spell1.SetFocus

Thanks in advance,

Shannan


Reading Text File And Inserting Data Into A SQL Table
Please help! I am getting a comma delimited text file from an outside vendor. I need to read the file, separate the sting into individual variables and insert the variables into a SQL table.
I have no problem if there is only one record but I can't seem to get my code to work when there are muliple records in this text file.

I know I need some sort of loop or do while not EOF statement. but I have not been able to get either to work.



Code:
Dim fso As New FileSystemObject, txtfile, _
fil1 As File, fil2 As File, ts As TextStream, s
Dim fldValue As Integer
Dim sLength As Integer

Dim cmdInsert As ADODB.Command
Dim cnDatabase As ADODB.Connection
Dim rsInsert As ADODB.Recordset
Dim prInsert(7) As Variant

Private Sub Form_Load()

Set fil1 = fso.GetFile("C: estfile.txt")
Set ts = fil1.OpenAsTextStream(ForReading)
s = ts.ReadAll

End Sub

Private Sub cmdOpenFile_Click()

Call getMSH
Call insertMSH

End Sub

Public Sub getMSH()

'Get the MSH Field Definition
fldValue = InStr(1, s, ",")
prInsert(0) = Left(s, fldValue - 1)
sLength = Len(s)
s = Mid(s, fldValue + 1, sLength - fldValue)

If prInsert(0) = "MSH" Then

'Get the Facility ID
fldValue = InStr(1, s, ",")
prInsert(1) = Left(s, fldValue - 1)
sLength = Len(s)
s = Mid(s, fldValue + 1, sLength - fldValue)

'Get the Physician name
fldValue = InStr(1, s, ",")
prInsert(2) = Left(s, fldValue - 1)
sLength = Len(s)
s = Mid(s, fldValue + 1, sLength - fldValue)

'Get the ERF Request Date
fldValue = InStr(1, s, ",")
If fldValue = 1 Then
prInsert(3) = "01/01/1900"
sLength = Len(s)
s = Mid(s, fldValue + 1, sLength - fldValue)
Else
prInsert(3) = Left(s, fldValue - 1)
sLength = Len(s)
s = Mid(s, fldValue + 1, sLength - fldValue)
End If

'Get the package ID
fldValue = InStr(1, s, ",")
prInsert(4) = Left(s, fldValue - 1)
sLength = Len(s)
s = Mid(s, fldValue + 1, sLength - fldValue)

'Get the Transaction Type
fldValue = InStr(1, s, ",")
prInsert(5) = Left(s, fldValue - 1)
sLength = Len(s)
s = Mid(s, fldValue + 1, sLength - fldValue)

'Get the number of PID records
fldValue = InStr(1, s, ",")
prInsert(6) = Left(s, fldValue - 1)
sLength = Len(s)
s = Mid(s, fldValue + 1, sLength - fldValue)

'Get the number of test
fldValue = InStr(1, s, ",")
prInsert(7) = Left(s, fldValue - 1)
sLength = Len(s)
s = Mid(s, fldValue + 1, sLength - fldValue)
Else
MsgBox "Try again"
End If

End Sub

Public Sub insertKIPHS()

'Establish the connection object
Call BeginConnection

'Establish the command object
Set cmdInsert = New ADODB.Command
cmdInsert.CommandType = adCmdStoredProc
cmdInsert.CommandText = "insert_kiphs"
cmdInsert.ActiveConnection = cnDatabase

'Establish the parameter objects
prInsert(0) = prInsert(0)
prInsert(1) = prInsert(1)
prInsert(2) = prInsert(2)
prInsert(3) = prInsert(3)
prInsert(4) = prInsert(4)
prInsert(5) = prInsert(5)
prInsert(6) = prInsert(6)
prInsert(7) = prInsert(7)

cmdInsert.Execute , prInsert


End Sub

Inserting Data From Text File Into A Access Table
Is there a easy way to take the data from a text file and intsert it into the proper fields of a table. I was gonna do it from within the database but I don't want to have to open the database to get it done. Anyone have a VB example on how to do this?

Thanks

Inserting Numbers In Front Of Text In A Rich Text Box.
I am trying to number each line of text in a rich text box without much success. It is my aim to number each line in tens. Does anybody have any ideas. All help much appreciated.

eg.

10 I am trying to number each line of text 20 in a rich text box without much success. 30 It is my aim to number each line in tens. 40 Does anybody have any ideas. All help
50 much appreciated.

ta.

Chris Brand.

Inserting A Line Break Into A Rich Text Box.
I want it to leave one line inbetween the first and the second. My current code looks like this:

output.text = "This is on the first line"
output.text = output.text + " "
output.text = output.text + "This is the third line"

How can I do that?

Problem With Inserting Image Into A Rich Text Control...
When I insert an image into a Rich Text box the image has one of those boxes around it for stretching/shrinking the image. It also adds menu items at the top (same one that appears in MS Paint).

Any ideas on how to get this to stop?

Inserting Page Break In Rich Text Control By Vb Coding
Dear Gurus,

Can anyone help me in inserting a page break in rich text edit control by vb coding? I am putting some text in rich text control at runtime and I want to insert a page break at some point.

Thanking you

Move Data From Datagrid To A Rich Text Format File
i wanna copy data shown in datagrid to a rich text format file
as a report to be printed
please elaborate a bit

thx....

Inserting Text In The Rich Text Box
I am a beginner and wanted help with the following :
I am making an application where I load file in a rich text box and then I want to insert text in it (where my cursor is) by using the command buttons . I cannot find any command for it. Can anyone tell me how to do it please.

thanks

Text Box Value Is Not Inserting Into The Data
I am using vb 6.0 , ORACLE 8.1.7 & win 2000 in my home

I am trying to insert values in the table. following is the code I wrote
my form has 2 mask edit box for Phone & fax (and mask property is set to ####### (7), other are text boxes)

Code:
Private Sub cmd_frm_wing_profile_dd_Click()
' create a connection object
Dim oconn As New ADODB.Connection
oconn = "Provider=OraOLEDB.Oracle;" & _
           "Data Source=tps;" & _
           "User Id=system;" & _
           "Password=manager"
oconn.ConnectionString = oconn
oconn.Open
Dim qry As String

MsgBox "id " & txt_frmwp_wingid
MsgBox "prin " & txt_frmwp_principal
MsgBox "cont " & txt_frmwp_controller
MsgBox "email " & txt_frmwp_emailadd
MsgBox "ph " & msk_frmwp_phone
MsgBox "fax " & msk_frmwp_fax
MsgBox "name " & txt_frmwp_blockname
qry = "insert into wing (wing_id, principal_name, controller_name, email_add, phone_wing, fax_wing) values (' " & txt_frmwp_wing_id & " ' , ' " & txt_frmwp_blockname & " ' , ' " & txt_frmwp_principal & " ' , ' " & txt_frmwp_controller & " ' , ' " & msk_frmwp_phone & " ' , ' " & msk_frmwp_fax & " ')"

Dim inscom As New Command
With inscom
   .ActiveConnection = oconn
   .CommandType = adCmdText
   .CommandText = qry
   .Execute
End With
oconn.Close
End Sub


If I check the value of the txt_frmwp_wing_id at line shown in red it shows me the contents that I entered, but the when it comes to the line shown in blue it shows me that txt_frmwp_wing_id is empty.
how can I resolve this error
follwing is the structure of my table

Create table wing
( wing_id char(2),
   principal_name varchar2(40) not null,
   controller_name varchar2(40) not null,
   email_add varchar2(50),
phone_wing char(7) not null,
fax_wing char (7) not null,
wing_name varchar2(15),
constraint wing_wing_id_pk primary Key (wing_id)
)

Inserting Text Data In Autocad
Hello Friends,
In Electrical Company I am working I
Design Department need to Insert Electrical Spec. of
component used in Drawings prepared.

Is there any method to insert the same from my
component database?

Is there any plugins already developed?

Please give me directions.

Sujith

Inserting Text At The Beginning Of An Existing Text File
I need to insert some data at the BEGINNING of an existing text file. All the solutions I've seen either append the text to the end of the file, or overwrite the data at the start of the file, or read the entire file into a string.

Can someone help me on this please.

Inserting Data At The Top Of A File
Hi,

I need to insert data at the top a of a file. These files can be huge and therefore I dont want to have to re-write the whole file.

I need a prepend function that will very quickly add a single line (column headings) as the first line in the file (as opposed to an Append function)

ideas?

Cheers

JAS

Inserting Data In EXE File
I need to insert some data into an EXE file, which my app will read... how can I do it in such a way that the computer won't want to run it, and it won't mess up the EXE?

Maybe I can put it at the beginning, and set the pointer in the header? How do I do that? I don't have any sound information, so I don't want to try it...

Any info?

Thanks!

Reading Data From A Rich Text Box
Hello again
Say i had a Rich text Box with this in it.

float 0.000000, 0.000000, 0.000000 ;vertex 0
float 0.000000, 0.000000, 0.000000 ;vertex 1
float 0.000000, 0.000000, 0.000000 ;vertex 2
float 0.000000, 0.000000, 0.000000 ;vertex 3
float 0.000000, 0.000000, 0.000000 ;vertex 4
float 0.000000, 0.000000, 0.000000 ;vertex 5
float 0.000000, 0.000000, 0.000000 ;vertex 6
float 0.000000, 0.000000, 0.000000 ;vertex 7

How could i make my app Read 4 lines at a time

and get thoes 0.00000 Values and store them as say
A
B
C
D
E
F
G
H
I
J
K
L

? then my app would do some calculations with thoes values ?

how can i do that ?

Data Justification In Rich Text Box
Hi sir..

We r developing CBTS using VB6.0 where we r using RichText box control for displaying data.We have taken care left alignment
only while data entry done.Now my problem is Displayed data
should be Justified in Rich Text Box control..

so please help me in finding the solution


Thank u

satya

Reading Rich Text Data
Hi

I'v got an Access database with memo fields on a table. I'm writing data into the memo fields through a RichTextBox using RTF format. Now I want to retrieve this data back from the database and use it in my application. Could this be done without using a RichTextBox control?
Even if I use the RichTextBox control to read the data, I'm not able to transfer the contents to any other control (for eg. textbox). My actual objective is to read the data and put it in a Word document using OLE. If I attempt doing this, the content is not in readable form. Is there a solution ?

Save Data In A Rich Text Box
This is a multi-part message in MIME format.

------=_NextPart_000_0019_01C15238.8B8CA0E0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello,

I am using VB 6.0 with an adodc connected to MS Access MDB.

I'm using "adodc1.recordset.update" and then "adodc1.refresh" to savedata in a rich text box, but the data does not save. How can I get therich text box to save the data?

Thanks

------=_NextPart_000_0019_01C15238.8B8CA0E0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1"http-equiv=Content-Type>
<META content="MSHTML 5.00.3315.2870" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hello,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>I am using VB 6.0 with an adodcconnected to MS


Access MDB.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>I'm using "adodc1.recordset.update" andthen


"adodc1.refresh" to save data in a rich text box, but the data does not


save.  How can I get the rich text box to save thedata?</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Thanks</FONT></DIV></BODY></HTML>

------=_NextPart_000_0019_01C15238.8B8CA0E0--

How To Get Rich Text In Data Report ?
How to get the Rich text in the Data report.. as the data is present in memo field of Table and I need to show the same in report.. can anybody help me..
Sarma ..kvsarma@yahoo.com

Why Is Rich Text Box Not Showing Real Structure Of Text File
hello,

my problem is the following :

i am loading a textfile in a richtextbox but it is not corresponding to the real structure of the textfile

can this be solved or is there another way to show a textfile on a form?

i added the textfile and a screenshot of the richtextbox(u can open it with clipboard viewer)

thnx

Inserting Text Into A File
Excel 2002 with Visual Basic 6.3

I have an XML file, which I'll call 2SimpleSamples.xml

<?xml version="1.0"?>
<NewDataSet>
<Measurements>
<Index>0</Index>
<Pos>1</Pos>
<ChemNumber>7</ChemNumber>
<ReadNumber>1</ReadNumber>
<Repeats>0</Repeats>
<FilterNumber>1</FilterNumber>
<Signal>193075</Signal>
<Reference>76668</Reference>
<TimeStamp>1255</TimeStamp>
</Measurements>
<Measurements>
<Index>1</Index>
<Pos>1</Pos>
<ChemNumber>7</ChemNumber>
<ReadNumber>2</ReadNumber>
<Repeats>0</Repeats>
<FilterNumber>1</FilterNumber>
<Signal>191867</Signal>
<Reference>76204</Reference>
<TimeStamp>1496</TimeStamp>
</Measurements>
</NewDataSet>

In a macro I have commands to select the xml file:


Code:
FilterList = "XML Files(*.xml),*.xml" 'Type of file to open


With Application
MyFileMod = .GetOpenFilename(filefilter:=FilterList)
End With
In order to format the data in a prescribed way in Excel, I have another file called 2SimpleSamples.xsl which is a style sheet associated with the file 2Simplesamples.xml. Actually, inserting the following line between <?xml version="1.0"?> and <NewDataSet> in the xml file above makes the association:

<?xml-stylesheet type="text/xsl" href="2simplesamples.xsl"?>

In my macro, after I open the xml file I need to insert(write) the above line into the xml file. Is it possible, and if so, how?

Thanks

Inserting A Text At The End Of Any File?
Hi,

I want to write a Hash string at the end of any file (mostly MDB file)
opened. I am doing something like this:

------------------------------------------------
Private Sub Insert_Click()
1Dim hValue as String
2Dim F1
3hValue = Text1.Text

4Open "ABC.MDB" For Binary AS #F1
5.
6Put #F1,....
7.
8Close #1
End Sub

--------------------------------------------------

I am not following how to go to the EOF, and Write text.
How to use it with PUT statement at line 6.

Please help

Inserting A Text At The End Of Any File?
Hi,

I want to write a Hash string at the end of any file (mostly MDB file)
opened. I am doing something like this:

------------------------------------------------
Private Sub Insert_Click()
1Dim hValue as String
2Dim F1
3hValue = Text1.Text

4Open "ABC.MDB" For Binary AS #F1
5.
6Put #F1,....
7.
8Close #1
End Sub

--------------------------------------------------

I am not following how to go to the EOF, and Write text.
How to use it with PUT statement at line 6.

Please help

Inserting In A Text File
Hi all:

Is there any way to insert a line into a text file at a specific point?  I understand the FSO, but I'll be darned if I can find anything in help.  It keeps telling me that the file needs to close from reading before I write to it.  (This is so much easier in .Net)

Thanks for any guidance.

Ron

Inserting Text Into A File
I don't know if I've even got the right language but I thought this would be the best place to ask.

My company has a few patches to roll out to over 50 sites throughout the country. The vendor has managed to make these as difficult as possible. I've got everything else figured out except for one thing - each site has to insert two lines of text into a file (editable by notepad). While it's an easy thing for me to do, I can't go to each site. The users don't want to deal with the solution the way it is now, let alone having to figure out how to insert this text no matter how much I explain it to them. I figured the best thing to do was write a little script to insert this text into the file and send it with the rest of the patches.

The problem? I'm not a programmer. Can someone help me out?

Inserting Text At The Beginning Of A Text File
I am writing the app in VB.NET but this is not a .NET specific question.

I have an already existing text file that has 200 lines. I need to insert a line at the top of the document but all I can figure out how to do is append it to the end. Can anyone point me in the right direction?

Thanks,

Jim

?? Inserting Text Line Into A Text File ??
Hi, well... does anybody knows how can i fix this code so i can INSERT a textline in a especific line of a text file (even fixing the EOF limit) ?

Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Dim fs, f, ts, s

Private Sub Form_Load()

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile("c:00001config2.txt")
Set ts = f.OpenAsTextStream(ForReading, TristateUseDefault)

Do Until row = "5"
row = ts.ReadLine
' MsgBox (row) checking values
Loop

Set ts = f.OpenAsTextStream(ForAppending,
TristateUseDefault)
ts.Write "Text Inserted" + Chr$(13) + Chr$(10)

ts.Close
End Sub



For a text file containing:
1
2
3
4
5
6
7

it sould end like this

1
2
3
4
5
Text Inserted
6
7


and now it ends like this

1
2
3
4
5
6
7
Text Inserted

and i want to avoid the EOF error too but i dont know when its going to end each time.

Note: this is because im doing like a win.ini file so y can store default values and modify the whole program just with that file:

[Config]
23
true

etc. Thanks a lot

Can VB Data Report Display Rich Text?
I need to display rich text in a VB data report. Can the data report display rich text? I can only get it to display the rich text with all the formatiing that goes along with it.

Thanks in advance,

Shannan

Data Justification In Rich Text Box Control
Hi..

We R Developing CBT 's with Using VB6.0 and MS Access..
while inserting data we r taking care of left alignment only.
At the same time while retriving data, the format should be justified in Rich Text Box Control..How to do this?


please advise this

Data Report Question And Rich Text
I am printing a data report and one field in the report is in Rich Text Format.  I need to keep it RTF because of the formatting, etc.  Currently it comes out on the data report like this :

{
tf1ansideff0{f0fnilfcharset0 MS Sans Serif;}}
viewkind4uc1partlang1033fs17
par    Procedure:  Sample procedure
par
par    Method:  Sample method here

Obviously not very appealing to the end user.  Is there any way to get the data report to print out Rich Text without the other stuff?  I am printing this stuff in a label on the data report.

Thanks in advance.  You guys always come to the rescue when I have one that holds me up.  

Shannan


[RESOLVE] Does Anyone Know How Much Data Can A Rich Text Box Hold?
Is there any other way to use beside the RichText box for the output??

I query a large data, on my .bat file display 10531 lines when I displayed this result in the ms excel

when i display them on my Richtext box in VB 6.0 I got only 1355 lines in the MS excel

I used the same format to query the data from a database. except one is on the .bat against the vb.

thanks,

stash




Edited by - stash on 1/16/2007 10:26:33 AM

Data Report - Displaying Rich Text From DB
Hi -

My question is: How do you display rich text (italics, underlines, bold) from a database on a Data Report?

I have written Rich Text from the MS Rich TextBox to a memo field in an Access Database.

I now need to display the text from the DB on a Data Report. When I bind the memo field to a RptTextBox field on the Data Report, it displays the data, but not the formatting. In fact it displays all the ASCII codes for the formatting that was in the MEMO field.

The data is being displayed like this:
{
tf1ansideff0{fonttbl{f0fnilfcharset0 MS Sans Serif;}}
viewkind4uc1pardlang1033f0fs17 Record 4: i ITALICi0 , ul UNDERLINEDulnone ,  BOLD0 , REGULAR
par }

THANKS!!

Save Last Line In Rich Text Box To Text File
From previous post - poor description

I have a Rich Text Box in which I load a log file (text file) for viewing & editing purposes. I would like to be able to save the file that is currently displayed as well as write the last line( the last line only, the line that the operator appended with a time stamp of completion), to be appended to the end of another text file file, that will be printed & cleared on a weekly or monthly basis.

Can anyone help me?

[resolved If Text Boxes Are Empty When Inserting Data Into A Database Table
hi I have an application in which I am saving new records to a database table. If a text box is empty, I get an error about not being allowed to use a null value. How can I still enter the data into the appropriate fields, even when SOME text boxes, therefore some fields, are empty?


Code:
Private Sub cmdSave_Click()

    Dim cnn As ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim sSQL As String

    Set cnn = New ADODB.Connection
    Set rs = New ADODB.Recordset
    
    With cnn
        .Provider = "Microsoft.jet.oledb.4.0"
        .ConnectionString = "Data source=" & App.Path & "intake.mdb"
        .Open
    End With

    sSQL = sSQL & "INSERT INTO Beds (Stuff, BedM01, BedM02, BedS01, BedS02, BedS03, BedS04, "
    sSQL = sSQL & "BedS05, BedS06, BedS07, BedS08, BedS09, BedS10, BedS11, BedS12, BedS13,"
    sSQL = sSQL & "BedS14, BedS15, BedS16,BedP01, BedP02, BedP03, BedP04, BedP05, BedP06, "
    sSQL = sSQL & "BedP07, BedP08, BedT01, BedT02, BedT03, BedT04, BedT05, BedT06, BedT07, "
    sSQL = sSQL & "BedT08, BedE01, BedE02, BedE03, BedE04, BedE05, BedE06, BedE07, BedE08, "
    sSQL = sSQL & "BedE09, BedE10, BedE11, BedE12, BedE13, BedE14, BedE15, BedE16, BedE17, "
    sSQL = sSQL & "BedE18, BedE19, BedE20 )"
    sSQL = sSQL & " VALUES ('" & txtDate.Text & "','" & txtSocial01.Text & "','"
    sSQL = sSQL & txtSocial02.Text & "','" & txtSocial03.Text & "','" & txtSocial04.Text & "','"
    sSQL = sSQL & txtSocial05.Text & "','" & txtSocial05.Text & "','" & txtSocial07.Text & "','"
    sSQL = sSQL & txtSocial08.Text & "','" & txtSocial09.Text & "','" & txtSocial10.Text & "','"
    sSQL = sSQL & txtSocial11.Text & "','" & txtSocial12.Text & "','" & txtSocial13.Text & "','"
    sSQL = sSQL & txtSocial14.Text & "','" & txtSocial15.Text & "','" & txtSocial16.Text & "','"
    sSQL = sSQL & txtSocial17.Text & "','" & txtSocial18.Text & "','" & txtSocial19.Text & "','"
    sSQL = sSQL & txtSocial20.Text & "','" & txtSocial21.Text & "','" & txtSocial22.Text & "','"
    sSQL = sSQL & txtSocial23.Text & "','" & txtSocial24.Text & "','" & txtSocial25.Text & "','"
    sSQL = sSQL & txtSocial26.Text & "','" & txtSocial27.Text & "','" & txtSocial28.Text & "','"
    sSQL = sSQL & txtSocial29.Text & "','" & txtSocial30.Text & "','" & txtSocial31.Text & "','"
    sSQL = sSQL & txtSocial32.Text & "','" & txtSocial33.Text & "','" & txtSocial34.Text & "','"
    sSQL = sSQL & txtSocial35.Text & "','" & txtSocial36.Text & "','" & txtSocial37.Text & "','"
    sSQL = sSQL & txtSocial38.Text & "','" & txtSocial39.Text & "','" & txtSocial40.Text & "','"
    sSQL = sSQL & txtSocial41.Text & "','" & txtSocial42.Text & "','" & txtSocial43.Text & "','"
    sSQL = sSQL & txtSocial44.Text & "','" & txtSocial45.Text & "','" & txtSocial46.Text & "','"
    sSQL = sSQL & txtSocial47.Text & "','" & txtSocial48.Text & "','" & txtSocial49.Text & "','"
    sSQL = sSQL & txtSocial50.Text & "','" & txtSocial51.Text & "','" & txtSocial52.Text & "','"
    sSQL = sSQL & txtSocial53.Text & "','" & txtSocial54.Text & "')"

    Debug.Print sSQL
    
    cnn.Execute sSQL

End Sub


Here is what I have tp insert the data into the fields, How can I enter this data if some controls have no contents?

Thank you for your help

Happieman



Edited by - Happieman on 5/22/2005 10:34:47 AM

Inserting Text Into Another Excel File
I can't figure out why this code won't work. I know it's the xlApp.TL.Range bit that's wrong but I can't find out what to put in there. I'm not too good with VB so I'll need it explained more than most people on here.

The TL variable is the name of the worksheet in the filename.xls file that needs to be edited. The code should open filename.xls, find the first empty cell in column C and input the text from TextBox10.

I'm totally stuck. Any help would be highly appreciated.

Dim TL As String
Dim xlApp As Excel.Application
Set xlApp = New Excel.Application
xlApp.Workbooks.Open "C:Filename.xls"
TL = ComboBox6.Value
xlApp.TL.Range("C65536").End(xlUp).Offset(1, 0) = "n/a"

Inserting Text At A Certain Line Of A File
I would like to know how to INsert Text (Without overwriting) into a textfile at a certain line.

Plz Help ASAP

Thanx,
Mikelo2k

Inserting Text In The Middle Of A .ps File
I had a similar thread about appending, until I realized that the "append" word was throwing myself and others off-track of what I was really trying to accomplish.

I want to search for a phrase in a .ps [really just a text file that is processed by a postscript printer or pre-processing software].

I want to search for that phrase in the file and replace it with another phrase. Any idea of how this can be accomplished?

Inserting A Line In A Text File
I was wondering what the best way would be to do the following:

I have a text file. The name of the text file is abc123.dat. What I would like to do, is open that file, and insert the name of the file (abc123 .. without the extension) as the first line of the file and then save the file. I know that I need to open the file, insert the data, and then save it but some code examples would be helpful. What should I use to insert the data into the file?

Thanks in advance for any suggestions.
Greg

Inserting Data Into The Middle Of A Binary File
what i want to do basically is insert data into a binary file without overwriting anything.

ex:

00000000: 1212 1212 1212 1212 1212 1212 1212 1212
00000016: 1212 1212 1212 1212 1212 1212 1212 1212
00000032: 1212 1212 1212 1212 1212 1212 1212 1212

to like:

00000000: 1212 1212 1212 1212 1212 1212 1212 1212
00000016: 1212 1212 1212 1212 1212 1212 1212 1212
00000032: 4444 4444 1212 1212 1212 1212 1212 1212
00000048: 1212 1212

how would i go about that?

Print Out Rich Text Stored In Data Base
Dear all,


How can I print out ( On Printer) rich text format that stored in msaccess data base that appare in rich text box in form .

Thanx

Rich Text Box Formatting When Bound To Data Control
I have a rich text box on my form, it is bound to an ADO Data Control. I can format the text in bold or not bold. The problem is

1. I highlight the text and click the bold button and it makes it bold.

2. With the text still highlighted I click the bold button and the text remains bold and the cursor moves to the first of the rich text box.

3. When I highlight the text again and click the bold button it unbolds and works fine.

I cannot consecutively click the button to bold and unbold text or to bold seperate highlighted text. The code works fine on a regular Rich Text box only when it is used on a bound Rich Text box does it go flakey.

Here is the code I am using in my Toolbar.
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key

Case "Bold"
If IsNull(RichTextBox1.SelBold) = True Or RichTextBox1.SelBold = True Then
' Code to run when selection is mixed.
RichTextBox1.SelBold = False
Toolbar1.Buttons("Bold").Value = tbrUnpressed
ElseIf RichTextBox1.SelBold = False Then
' Code to run when selection is not bold.
RichTextBox1.SelBold = True
Toolbar1.Buttons("Bold").Value = tbrPressed
End If
End Select

End Sub

Thanks
Brandon

Problem Inserting A Text File Into An ACCESS DB
When I insert this text file into my db I asigned the size of each field this way:
date = Trim(Mid(LineaLeida, 1, 10))

But it gives me a problem when one particular field changes its length from time to time (it doesnīt have a constant length). Iīd like a way of measuring the fieldīs length and taking as many characters as its length instead of taking some of the next fieldīs characters in order to complete its defined length, which is whatīs happening now.

I know what I have to do but Iīm not sure how to do it?, maybe someone could help me out on this one.

Thanks!

================================================== =================================================
This is part of my code:

NumFichero = FreeFile
Open Path For Input As NumFichero

Do

Line Input #NumFichero, LineaLeida
fecha = Trim(Mid(LineaLeida, 1, 10))
hora = Trim(Mid(LineaLeida, 12, 8))
usuario = Trim(Mid(LineaLeida, 21, 12))
codigo = Trim(Mid(LineaLeida, 34, 12))
cliente = Trim(Mid(LineaLeida, 47, 7))
cuenta = Trim(Mid(LineaLeida, 55, 7)) <=====================This is the field that changes its length
movil = Trim(Mid(LineaLeida, 63, 10))
ci = Trim(Mid(LineaLeida, 74, 2))
mes = Trim(Mid(LineaLeida, 77, 4))
estado = Trim(Mid(LineaLeida, 82, 31))

If fecha <> "Fecha" Then

query = "INSERT INTO log (fecha, hora, usuario, codigo, cliente, cuenta, movil, ci, mes, estado) VALUES ('" & fecha & "', '" & hora & "', '" & usuario & "', '" & codigo & "', '" & cliente & "', '" & cuenta & "', '" & movil & "', '" & ci & "', '" & mes & "', '" & estado & "') "
'txtfields1.Text = query
db.Execute (query)

End If

Loop Until EOF(NumFichero)

Close NumFichero

================================================== =================================================

Read File By Columns And Inserting Data Into Excel
Trying to export data from a txt file into a excel file.

* i have include a txt file which i am trying to read.

Have found lots of examples that will read line for line and even do some of them insert data into excel

However i have not been able to figure out how to read the txt file
by reading the first 31 lines as lines and inserting them into excel. and than from line 32 untill end of document reading the text in columns which are divided with a "|" and inserting that data into columns into the excel file.

examples i found reading a inserting text kinda look like this

Code:


Option Explicit

Private Sub Command1_Click()
Dim xl As Excel.Application
Dim wb As Excel.Workbook
Dim sheet As Excel.Worksheet
Dim x As Integer
Dim y As Integer
Dim lines() As String

Set xl = New Excel.Application
xl.Visible = True
Set wb = xl.Workbooks.Add
Set sheet = wb.Sheets("Sheet1")

lines = GetLines
For x = 0 To UBound(lines)
For y = 0 To Len(lines(x)) / 8
sheet1.Cells(x + 1, y + 1) = Mid$(lines(x), (y * 4) + 1, 4)
Next
Next

Set sheet = Nothing
Set wb = Nothing
Set xl = Nothing
End Sub

Private Function GetLines() As String()
Dim ff As Integer

ff = FreeFile
Open App.Path & "file.txt" For Input As #ff '
GetLines = Split(Input(LOF(ff), ff), vbNewLine)
Close #ff
End Function



Any help would be Very NICe

How Do I Read A Text File Into A Rich Text Box?
hey i want to read from a text file and display it in a text box... any ideas?

Copyright Đ 2005-08 www.BigResource.com, All rights reserved