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





See Related Forum Messages: Follow the Links Below to View Complete Thread

Read A Text File In Reverse?
I have a text file I want to open at end, then read the last row. (So I can extract the timestamp from the last record written.)

Is there a way to open a file at end and read in reverse one record?

Thanks for nay help
Milt.

Edit A Text File In Reverse Order?????
i want to edit a text file in reverse order using vb
how do i do that
what i mean is that i have to read a file in reverse order
and whenever and wherever "urstdm" occurs i've to delete the next 5 line say if the file is like

1333444
ssddd

ddddd
sdds
f kkjkkljkj kjlkjljlj jljljljll
ffggg sddsfdf ffdffsdfdfd klklklkl
urstdm
fgfgfg
fdfggg
ghhjjkhk

i need the output to be

1333444
ssddd


fgfgfg
fdfggg
ghhjjkhk


please help me the keyword urstdm always occurs at the starting of a new line.

Write To Text File In Reverse Order
I would like to be able to write to a text file so the new stuff is at the top of the file.
i.e.
INSTEAD OF:
TEST1
TEST2
TEST3
TEST4
TEST5

I WOULD LIKE:
TEST5
TEST4
TEST3
TEST2
TEST1

Not for sure how to accomplish this:  Thanks for the help

Here is my existing code
'create reference to Microsoft Scripting Runtime

On Error Resume Next
Dim fso As Object
Dim txtFile As Object
Dim ErrorLogDir As String
ReportDir = "M:SAPSTRP rp_reports1PrintDetails.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
Set txtFile = fso.OpenTextFile(ReportDir, ForAppending)
txtFile.Skip (2)
txtFile.WriteLine "Test9"

Removing Duplicate Entries In A Text File
I have an email list that has an email address on each line. The problem is that some emails appear more than once in the file.

I'd like to parse out the dups and create a file of non-dups and a file of all the dups

here' the code I have and it sure isn't working. Maybe my brain isn't working right today


Code:
set objFS=CreateObject ("Scripting.FileSystemObject")
set listFile = objFS.OpenTextFile ("BADEMAILS.txt")
set listFile1 = objFS.OpenTextFile ("BADEMAILS1.txt")

set logfile = objFS.CreateTextFile("Final-Removed.txt")
set logfile1 = objFS.CreateTextFile("Final-Removed-dups.txt")

count = 1
do while listFile.AtEndOfStream <> True
line1 = listFile.ReadLine

count1 = 1
listFile1.open
do while listFile1.AtEndOfStream <> True
line2 = listFile1.ReadLine

if line1 <> line2 then
logfile.writeline line2
else
logfile1.writeline line2
end if

count1 = count1 + 1
Loop

listFile1.close

count = count + 1
Loop

BADEMAILS.txt and BADEMAILS1.txt are identical. The only way I could think is to open one file and walk down each line while looping through a different file with the same content parsing out the dups?

Any help would be appreciated

Thanks

Remove Duplicate Entries From Text File....
hi, say i have a textbox with numbers like this:


345
645
878
8978
585
64
3
56


how would i make a program which removes duplicate entries from the textbox? i've more or less got a similar bit of code working which works for a listbox, but i'm kinda stuck with how to do it on a textbox. can anyone help?

Print Text Box Entries To Seperate .txt File
I am very new to VB and am currently trying to work out how to copy each answer from a text box into a .txt file. For instance name and address details. Can anyone help ?

Thanx in advance,

Putting Text File Entries Into An Array
Hey all!

OK, what I want to do is put a whole bunch of names into an array from a text file. The names are already in correct order, all I want to do is get entry #1 into label #1, entry #2 into label #2 etc. How do I do this?

This is what I've got, but I know it doesn't work.


Code:
Private Sub Form_Load()
Dim Name as String, i as String

Open "c:lennycollingwoodfilesPlayers.txt" For Output As #1
For i = 1 To 52
Input #1, Name
lblPlayer(i).Caption = Name
Name = ""
Next i

End Sub



Thanks in advance for any help you can offer.

Deleting Duplicate Entries In A Text File
okay here is my code...i can load the file and add to it and close it and i know how to check for duplicate items, but how can i delete the duplicate entry....

private Sub Form_Load()
Dim Temp as string
lstClient.Clear ' clear current entries
Open "C:
ame.txt" for input as #1
Do Until EOF(1)
Line input #1, Temp
lstClient.AddItem Temp
Loop
Close #1
lblDisplay.Caption = lstClient.ListCount
End Sub

private Sub cmdClose_Click()
Dim X
Open "C:
ame.txt" for Output as #1
for X = 0 to lstClient.ListCount - 1
print #1, lstClient.List(X)
next X
Close #1
Unload me
End Sub




thanx in advance

midnight service

Search/Replace In Text File Based On Database Entries.
I'm writing an application to take a text file and run a find and replace function on the text based on some entries in a database.  Say you have a text file that is comprised of thousands of lines that are formatted pretty similarly (comma delimited).  I want it to read through the lines and every time it comes across the Product type of Equifax Infile, to change the Category to Developed Report.  And for all Products that are undefined (else) the Category should be set to Developed Report.  The categories and products are saved in a database that is editable by the user.  The Product table contains a foreign key to link to the Category table so as to create a one-to-many relationship.  As I am pretty new to the whole programming world, any help anyone could provide would be appreciated.  I have sample code and text file if you would like.  Please let me know if you have any ideas for this function.  Thank you very much for your help.

Convert More Than 255 Column Entries Of Database, Originally From Tab Delimited Text File
I was looking to convert the data in a tab delimited text file, which when expanded would run upto 295 columns in a ms-access database(two table in access) or two excel worksheets in msexcel. Since the data is tab delimited I am encountring few problems in deciphering the logic. I am using this piece of code for this entire process. CAN ANYBODY HELP ME WITH THIS....Please

PS: the line where variable k checks on numbers is to check the last field in each table defined in local array I find errors hitting when there is a zero-length character in the text field. str(k)="" looks for those.. also there are date datatype defined in the msaccess database there is type mismatch error occuring due to this zero length character as the tab count in the text file increases by 1 always!!

Code:Dim rs As New ADODB.Recordset
Dim tabb As Variant
Dim i As Integer
On Error Resume Next
tabb = Array("Universal_Form", "Employee_Data", "Spouse", "First_Dependent", "Second_Dependent", "Third_Dependent", "Fourth_Dependent", "Fifth_Dependent", "Life_Group", "Health_Questions", "Explanation_1", "Bankers_Life_Insurance")

    Set tx = fso.OpenTextFile(App.Path & "/S1UN003.txt", ForReading)
        While Not tx.AtEndOfStream
            Stop
            str = Split(tx.ReadLine, vbTab, , vbTextCompare)
            If UBound(str) < 295 Or UBound(str) > 295 Then Exit Sub
            j = 0
            i = 0
            For k = 0 To UBound(str)
                If Not k = 36 Or k = 39 Or k = 55 Or k = 71 Or k = 87 Or k = 119 _
                       Or k = 135 Or k = 181 Or k = 209 Or k = 227 Then
                    If tabOpen = False Then
                        rs.Open "SELECT * FROM " & tabb(j), con, 2, 3
                        If j = 2 Then Stop
                        rs.AddNew
                        If str(k) = "" Or IsNull(str(k)) Or str(k) = " " Then
                            If rs.Fields(i).Type = adDate Then
                                Stop
                            Else
                                rs.Fields(i) = Null
                            End If
                        Else
                            rs.Fields(i) = str(k)
                        End If
                        tabOpen = True
                    Else
                        If str(k) = "" Or IsNull(str(k)) Or str(k) = " " Then
                            If rs.Fields(i).Type = adDate Then
                                Stop
                            Else
                                rs.Fields(i) = Null
                            End If
                        Else
                            rs.Fields(i) = str(k)
                        End If
                    End If
                    i = i + 1
                    If k = 37 Or k = 40 Or k = 56 Or k = 72 Or k = 88 Or k = 104 Or k = 120 Or k = 136 Or k = 182 Or k = 210 Or k = 252 Or k = 295 Then
                        rs.Update
                        rs.Close
                        tabOpen = False
                        j = j + 1
                        i = 0
                    Else
                        rs.Update
                    End If
                End If
            Next k
        Wend
    Set tx = Nothing

Reverse Text ??????
hi
i have a text like this

Code:
{150}{300}first line
{350}{850}second line
{1100}{1600}third line
....
....
....

how can i Reverse this text without Reverse {****}{****} to be in the form

Code:
{150}{300}enil tsrif
{350}{850}enil dnoces
{1100}{1600}enil driht

Reverse Text.
I want ti write from right ti left

Reverse Text
How can i make it Print something out The opposite way they type it in

for eg they type in
hello
it prints
olleh

? how do i do this

Reverse Text
I have a textbox for the user to input directions for a game(N E S W) what i neem is for when they hit the reverse button the text in the box becomes backwards. any help?

How To Reverse Text In A Textbox Vb6.0
Hi there

How can i highlight text in a text box, like each text letter in a text box in Visual Basic
6.0. not the whole word just each letter.
and reverse it by putting it in another text box
. How would i write it, or where can i find out more about
it.
I no this seems easy but how.
Thank You..

Reverse Text Problem
Hi,

Is it possible to print or display on screen text that has been reversed.
I dont mean purplegerbil into libregelprup but when printed out if you hold it up to a mirror it will read correctly?

any examples would be great.

Cheers pG

Text Box Reverse *Resolved*
i want to take the input of a text box and when you press the command button it takes the input from the text box and then just makes it backwards and prints it to the text box. like "Ihasn" would be "nsahI". Anyone have any ideas? I know this is stupid but if i can get this to work i can add it to the rest of my program. Help would greatly be appricated.

Text Selection In Reverse
I've got textboxes auto-selecting the text when they get focus, but it seems the only way I can do it is to set SelStart to the beginning and SelLength to the end of the text, thus putting the cursor at the end. I want to reverse that, and have the selection start at the end and end at the start (wasn't there a Seinfeld episode along those lines?).

Using a negative SelLength doesn't work, nor does the API SendMessage EM_SETSEL, as they both simply move the cursor to the rightmost part of the selection.

--
Dyolf Knip

Reverse Select A Text Box
Hey,

I have a single line text box. I would like to select the text in the text box so that when that text box receives focus, the text would be selected from right to left instead of left to right. Left to right selection if provided by :

txtBox1.SelStart = 0
txtBox1.SelLength = Len(txtBox1.Text)

Reverse Text-selection
I want to select a portion of a string. I do not want to select it from left to right but from right to left...
Example:

I want selstart to be at 6
and I want it to end at 3

Basicly I want the cursor at the beginnning of the selection, not at the end.

Printing Text In Reverse Colors
There's always a little workaround if you know it...

Add a picturebox to the form, paint a black rectangle on it, paint white text on it, and then paintpicture the text on to the printer.

How Do I Print Text/graphics Reverse Video?
I have an application where I need to print out a label
sheet with white letters and a black background.

I've figure out how to print text and line art using:

Printer.print "stuff"
Printer.line (x1,y1)-(x2,y2)

But how do reverse video everything? I want my lines and
text to come out white and the surrounding area in black.

I'm using VB4.0 and a normal B&W laser printer.

Thanks very much.

Phil Hall

Reverse Compile .exe File
Is there any way to reverse compile a .exe file?

Reverse Searching In INI File
hi,

I have the following layout in my INI file:

[Root]
ChildsCount = 2
Child1 = Disk A
Child2 = Disk B

How can I traverse from "Disk A" to get the keyname, "Child1" and then get the root key, "Root"?

Reverse Engineering A .LNK Or .PIF File
I need to be able to extract the information from a .lnk or .pif file.
There is a un-supported sample program on the VB 6.0 CD that will do this (Shelllnk.vbp) but it uses a .TLB file to do its dirty work. This file is described as VB 5 - IShelllink Interface and I am reluctant to depend on it since I have no way of knowing if and when it will break.

My project needs to CREATE Shortcuts, of which I have found many samples on how to do this, and EXTRACT the information from the created shortcuts as well as shortcuts created by other methods, such as Drag/ Drop using Right click in Explorer.

Is there a "official" way of extracting the information from a shortcut?

Any comments or suggestions would be appreciated.

Thanks in advance

John G

Text Entries
This is what i have so far

Code:
Open "edittext.txt" For Output As #1
Open "originaltext.txt" For Input As #2

x = 1
Do While Not EOF(1)
Input #2, UserName, UserID
If Not NewUser.User.Selected(nIndex) = UserName Then
Write #1, UserName, UserID
End If
x = x + 1
Loop
Close #1
Close #2
It doesn't write anything to text.txt , can anyone tell me what is going on??

Also, how do i rename edittext.txt to originaltext.txt. I think i have to kill originaltext.txt first.

Text Box Entries
I have put several Text Box's on a Form and assigned this as Text in the Text Box's property sheet "[- Available -]". When I try to Type something in th TextBox it won't do it nothing Happens. Do I have to erase what's in the Box and Then Type or What?

How To Encrypt File From Reverse Engineering ?
Such as hex editing, disassembling and decompiling etc.. How would i encrpt a compiled exe to gaurd against these techinques without file corruption ?

again, advice of code appreciated.

Reverse Engineering File Formats
I would like to make a program that organizes replay files from this new game called Netkar, however, I don't know the format of the replay files(.nkr). My friend Aaron told me that I should look into reverse engineering the file format. Could anyone help me out with this? Thanks a lot! You guys rock!

Jason

Saving Text Box Entries
Is there a way to save the entry in a text box so that the next time the user form is entered the text that was entered the last time appears in the text box?

For example, when my VBA user form pops up I ask for the company name and their website which they enter into a text box. Is there a way for that information to be there when they open the word document in the future?

Thanks.

Mike

Multiple Entries In 1 Text Box
I need help doing something with a text box. Heres the situation... I have a command that brings a text box visible to the form. I then want the user to input say "5" into the text box... and then hit a command that says add which takes that number to a label called total... then if the user has another number to put into the text box, the first one entry deletes after the add command is pushed and the user can put another entry in the same text box. Say the number is "4", then the add command is pushed again deleting the "4" and adding it to the 5 previously in the label. Can somebody help me with pseudo code?

Textbox Entries To Show Latest Appended Entries.
How do set a textbox to show the latest appended entry? When data is appended to a text box it always resets to the top of the window. To view the appended data one must scroll down. I would like to keep the latest viewable. Any ideas, please?

Write Base64 String To File/reverse?
How would I go about encoding a file into base 64 and then decoding it and writing it to a file? I tried searching past posts and got nothing.

Thanks!

Saving Text Entries In UserForms
I am using VBA in Reflection, a terminal emulator software. I am building a UserForm to replace a series of input boxes that the user is currently being prompted for. The input boxes have code to save the last entry in the box so that the user does not have to re-enter the same data every time. Is there a way to use code for each text box in a UserForm to store the last entered data, until the user changes it?

Thanks

Grab Text Entries From A Dropdown
How can I grab all the choices in a combobox?

To Check For Blank Entries In A Text Box
Hi friends

First of all let me introduce myself, I am Peters A P. I just started learning VB.

I have a question regarding the following

I have a form, where I want to enter alphanumeric values in the text box and then it should update to the database.

The form has around 25 text boxes, out of which I need to enter complusorily for 10 textboxes. How do I check that and give an error message if I forget to enter one value in one textbox.

I am pasting part of codes below, here I am checking for text1.box whether it is blank, similarly, i need to check for 9 more text boxes. How do I do that


Private Sub cmdSave_Click()
Dim contactrec As New ADODB.Recordset
contactcon.Open "smmdetails"
Set contactrec = contactcon.Execute("Select * from smm_details")
If contactrec.BOF = True Then
If txtBox1.Text = "" Then
MsgBox "Please enter Name of the Firm"
Else
contactcon.Execute ("insert into smm_details(name_of_company, type_of_business, ho_address, ho_city, ho_country, " & _
"ho_tel_no_1, ho_tel_no_2, ho_fax_no_1, ho_fax_no_2, ho_email_1, ho_email_2, ho_website, ho_contact_person, ho_contact_person_mobile, " & _
"local_address, local_city, local_country, local_tel_no_1, local_tel_no_2, local_fax -no, local_email, local_contact_person, local_contact_person_mobile, " & _
"sponsor_name, sponsor_tel_no_1, sponsor_tel_no_2, sponsor_fax_no_1, sponsor_mobile_no, sponsor_email, owner_name, owner_tel_no_1, owner_mobile_no, " & _
"owner_passport, owner_nationality, owner_passport_expiry) Values('" & txtBox1.Text & "')")
End If
Else
MsgBox "Record Already Exists"
End If
contactrec.Close
End Sub

Find Previous Entries In Text Box
You know guys how on internet explorer if you previously have entered a string in a text box it remembers every value that has been entered before in that text box and gives you the list. For instance if you are trying to login to a website you start typing your user name. Let's say my user name is hespinoza. If I type "h" then in the list will appear all entries begining with "h" If I type "e" then the list will filter its contents and only display values that start with "he" Does anyone has something that would help me figure this thing out?

Thanks a bunch.

Deleting Double Entries In Text Files. How To?
hello,

I have a text file with the following information:
name, address, phone number
I want to use vb to delete entries with the same name, so I would
have only the latest updated information about that name.
how can I do this with vb?

thanks

[solved] Sorting Entries In Text Files
foe example i have a text file named mydbs.txt

the entries inside it are
anything 12.00
others 65.65
helpme 56.76
anyone 96.65
schizo 44.44

how do i get the entries to be sorted where the highest entry is on the top of the file...

How To Limit Text Box Character Entries To NUMBERS Only??
How can I make is so that a user can only enter numbers in text boxes?

Thanks

Multiple Text Box Entries On Form To Array
Can anyone help. I have multiple text boxes on a form, and I want the code to go through each text box and put the text in to a 2D array.

The text boxes are created after the user input the number of verticies, 2 verticies creates 4 text boxes done with this code

Private Sub Form_Load()
Dim ctlName As Control
Dim TBox_name As String
Dim Tbox_value As String
Dim i As Integer
Dim Top As Integer
i = 0
Top = 500
TBox_name = "Text"
For i = 0 To Verticies - 1
    Tbox_value = CSng(i + 1)
    TBox_name = TBox_name + Tbox_value
    Set ctlName = Form4.Controls.Add("VB.TextBox", TBox_name, Form4)
    ctlName.Visible = True
    ctlName.Top = Top * (i + 1)
    ctlName.Left = 500
    ctlName.Width = 700
    ctlName.Height = 200
    Tbox_value = CSng(i + 2)
    TBox_name = TBox_name + Tbox_value
    Set ctlName = Form4.Controls.Add("VB.TextBox", TBox_name, Form4)
    ctlName.Visible = True
    ctlName.Top = Top * (i + 1)
    ctlName.Left = 1700
    ctlName.Width = 700
    ctlName.Height = 200
Next
Form4.Height = (Top * (i + 1)) + 500
End Sub

Thanks for your help.

Iain

Need A Code That Alowes Entries In Text Boxes To Be Saved
Hi,

I am very new to VB..
I'm hoping some of you might be able to help me make a code to apply in text boxes made in MS Word 2000..

I have made a document with several text boxes, and saved it as a web page.
When I open the document in IE, I can add text in the boxes, and print it out.

What I would like is to be able to save the webpage with the entered text still in the boxes...
When I save now, and reopen, the boxes are empty..

Any hints?


Brgds André

Collect The Entries Made In A Text Box In A Variable After Each Execution
code for the following steps

1.Declare a variable globally say Var_NEW
2.Store the value in a text field in the variable Var_NEW everytime with a terminating string like ‘;’
3.For Ex: if the text is entered for first time, then the variable holds like VAR_DSN=<FIRST_NAME>; second time VAR_DSN=<FIRST_NAME>;<SECOND_NAME>;

Deleting Double Entries In Text Files. How To? *Not Solved*
I tried with no success to delete double entries in a text file.

I'll explain, I have a text file with the following information:
name, address, phone number
I want to use vb to delete entries with the same name, so I would
have only the latest updated information about that name.

previous help also did not work...

http://www.vbforums.com/showthread.p...hreadid=304157

so I'm still not in my happy place...

any help?

Deleting Entries From INI File
Using something in the lines of GetPrivateProfileStringA or WritePrivateProfileStringA functions, how do I delete a Key from an INI file that's stored in the Windows directory?

Thanks.

Help On Displaying Certain Text As A Label In A Form Based On All Entries In Status Field
I have a ExamTaken Table that has the following fields:

1. ExamID as Primary Key
2. ExamDate
3. Score
4. Status. The status field has a combo box that gives two choices Pass or Fail. The status field actually stores an ID which is ID="5" for Pass
and ID = "4" for Fail.

My Question. I have a form that displays all exam ID, the score, date and status. I have a Lable named lable13 at the top of the Form that displays a text msg "Overall Result: "
What I need to do is, if all the status in the status field is Pass then Me.Label13.Caption = "Overall Result: Passed" and If any of the status field is set to Fail then the Me.Label13.Caption = "Overall Result: Failed"

So if there are 6 exam ID and the status field for each ID is selected as Pass then the Label13 should display "Overall Result: Passed" however if any of the status field is selected as Fail for any exam ID then the label13 should display "Overall Result: Failed"

I have included a sample database to give a better understanding on what I am trying to achieve.

Thanks for all you response,
Ket

Writing To File Without Duplicating Entries
Code:
Private Sub Image3_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Open "C:documents and settingsownerdesktopdesigner's toolzdevelopment projectsdesigners toolz cmusers.lst" For Append As #1
Print #1, Combo1.Text
Close
End Sub


As you can see from the code, it puts whats in combo1 into a file.

Lets say combo1 has these contents:

DodgeRida67
DodgeRida67

If thats the case, I dont want it to be put in the file twice. Just once. And, if the file Already has DodgeRida67 in it, I want Dodgerida67 not to be put in the file at all. Hope this isnt confusing. Help greatly appreciated. Thanks.

Determine Number Of Entries In A File
I am opening a file thus:

Open App.Path & "Words.dat" For Input As #1

Is there a function to determine the number of 'entries'
(records) in that file?

Automatically Add Entries To HOSTS File
hey..how would i code an app in VB..to automatically add entries into the hosts file?

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