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




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?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
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...

Deleting Entries From Ini Files.... ?
I know how to read & write ini files, but how do you remove entris? Is there an API function? ... something like WritePrivateProfileString that delets?

Thanks.

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

Double Entries
Afternoon

I am having a problem with one of my macro's. I have a excel main sheet and all the months on a different sheets in the same document. On the main sheet i have a end date and the macro takes the end date and copies that line to the correct month. Now if i go into the document tomorrow and add loads more line in the master documents and then press go it re-sorts and copies all the line even the old ones into the months making double entries. Is there a way to for it to check or stop making the double entries and only add the new lines.

Here is the code i have for sorting it:

Code:
Option Explicit
Const CountColumn = 15 ' the column in which the count formula is to be entered





Private Sub Go_Click()

Dim currentMonth, intLimit, intX, intCurrentRow As Integer
Dim months
months = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
ThisWorkbook.Sheets("January").Cells(1, CountColumn) = "=count(A:A)+1"
ThisWorkbook.Sheets("February").Cells(1, CountColumn) = "=count(A:A)+1"
ThisWorkbook.Sheets("March").Cells(1, CountColumn) = "=count(A:A)+1"
ThisWorkbook.Sheets("April").Cells(1, CountColumn) = "=count(A:A)+1"
ThisWorkbook.Sheets("May").Cells(1, CountColumn) = "=count(A:A)+1"
ThisWorkbook.Sheets("June").Cells(1, CountColumn) = "=count(A:A)+1"
ThisWorkbook.Sheets("July").Cells(1, CountColumn) = "=count(A:A)+1"
ThisWorkbook.Sheets("August").Cells(1, CountColumn) = "=count(A:A)+1"
ThisWorkbook.Sheets("September").Cells(1, CountColumn) = "=count(A:A)+1"
ThisWorkbook.Sheets("October").Cells(1, CountColumn) = "=count(A:A)+1"
ThisWorkbook.Sheets("November").Cells(1, CountColumn) = "=count(A:A)+1"
ThisWorkbook.Sheets("December").Cells(1, CountColumn) = "=count(A:A)+1"
ThisWorkbook.Sheets("Master").Cells(1, CountColumn) = "=count(A:A)+1"



Dim tmpSheetName As String
intLimit = Int(ThisWorkbook.Sheets("Master").Cells(1, CountColumn).Value)

For intX = 2 To intLimit
currentMonth = Int(ThisWorkbook.Sheets("Master").Cells(intX, 14).Value) - 1
tmpSheetName = months(currentMonth)
Sheets("Master").Select
ActiveSheet.Range("A" & intX & ":M" & intX).Select
Selection.Copy
Sheets(tmpSheetName).Select
intCurrentRow = Int(ThisWorkbook.Sheets(tmpSheetName).Cells(1, CountColumn).Value) + 1
ActiveSheet.Range("A" & intCurrentRow).Select
Selection.PasteSpecial (xlPasteAll)
Next intX

End Sub
Help would be appreciated.
Thanks

ADO's, MDB's And Double Entries
I am using an ADO to add new records to an Access MDB file and It is adding the same record twice. I am using very simple code. The code that I am using if as follows:


Code:
adoPrice.Recordset.AddNew

adoPrice.Recordset.Fields("Products") = Name
adoPrice.Recordset.Fields("Item #") = Number
adoPrice.Recordset.Fields("Reg User Price") = Reg
adoPrice.Recordset.Fields("Direct Price") = Prospect
adoPrice.Recordset.Fields("Description") = Descriptions
' Update the records
adoPrice.Recordset.Update



If anyone can help me it would be greatly appreciated

Filtering Out Double Entries
Hi all,

I'm using SQL server 2k and VB 6.0 and I am making a datareport using a view
but now I have ran into a problem:
some of the dates in the view are double(ex. 24-3-2004 14:40:23 2 times(different record)) this is probably caused by a hickup in the IIS server but we want to filter those double records out how can I do that cause I am not that good in SQL

THx in advance,

GravGunner

Set breakpoints at keyevents,that helps most simple problems 9 out of 10 times.
Silence......Man's biggest fear,causer of insanity.....yet his biggest friend in times of need....
In total silence the sound of a heartbeat is louder then the sound of your own death

Edited by - GravGunner on 8/27/2004 5:05:02 AM

SQL Statement Pulling Double Entries (Resolved)
I'm trying to load a combobox from an Access database.
The problem is that I'm getting duplicate entries in the combobox when the Admin logs in.

The Adim is always UserID = 1
There are two types of Assertions, Public and Private

The Admin can edit all Public Assertion
but can only edit Private Assertions if the user allows it.

Relevant tables in the DB:

Code:
tblAssertions
(Fields)
UserID 'The owner of this Assertion. If set '1' then it's a public snipped
Assertion ' A text snipped
GroupID 'links to another table, not important here

tblUsers
(Fields)
UserID 'Linked to tblAssertions
UserAcceptsAdim 'Tells if this user allows the Admin to have access to the users private assertions



VB Code:
Private Sub cmbAssertionLoad()    Dim rsAssertion As ADODB.Recordset    Dim sSQL As String        cmbAssertion.Clear    Set rsAssertion = New ADODB.Recordset    If g_lUserID = 1 Then        'admin- all public assertion Plus any user assertions that allow admin access'this is the SQL statement with a problem        sSQL = "SELECT * FROM tblAssertions A, tblUsers U " & _               "WHERE A.GroupID =" & CStr(m_lTempGroupID) & _               "AND (A.UserID = 1 " & _               "OR ((A.UserID = U.UserID) AND U.UserAcceptsAdim = True))"    Else        'user - only load assertions that belong to this user        sSQL = "SELECT * FROM tblAssertions WHERE GroupID =" & CStr(m_lTempGroupID) & " UserID = " & CStr(g_lUserID)    End If    rsAssertion.Open sSQL, cn, adOpenKeyset, adLockPessimistic, adCmdText    If Not rsAssertion.EOF Then        rsAssertion.MoveFirst        Do While Not rsAssertion.EOF            cmbAssertion.AddItem rsAssertion.Fields("Assertion")            cmbAssertion.ItemData(cmbAssertion.NewIndex) = rsAssertion.Fields("AssertionID")            rsAssertion.MoveNext        Loop    End IfEnd Sub





Added green "resolved" checkmark - Hack

Deleting Entries In A Txt
This is how I add entries to the txt file:

Code:
Open "text.txt" For Append As #1
Write #1, UserName.Text, UserID.Text
Close #1
'next, UserName will be placed in a list box
Open "text.txt" For Input As #1
x = 1
Do While Not EOF(1)
Input #1, UserName, UserID
List1.AddItem UserName 'the list box displays the data as check boxes
x = x + 1
Loop
Close #1
what code do i use to delete the selected entries from the list box and the txt file??

Deleting Entries
i'm trying to figure out how i can delete the entries in a column in a database, and i haven't figured it out yet....

got any clues that might direct me in the right direction ?

Deleting Entries In An Array
Hi,

I want to be able to delete specific entries from my arrray, after I select them from a combobox, has anybody got any suggestions on how to?


Code for the combobox:

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


Private Sub Combo1_Click()
txtID.Text = uStudent(Combo1.ListIndex + 1).ID
txtFirst.Text = uStudent(Combo1.ListIndex + 1).Firstname
txtLast.Text = uStudent(Combo1.ListIndex + 1).Surname
txtForm.Text = uStudent(Combo1.ListIndex + 1).Form
txtNo.Text = uStudent(Combo1.ListIndex + 1).EntryNo
txtLetters.Text = uStudent(Combo1.ListIndex + 1).Letters
txtWeeks.Text = uStudent(Combo1.ListIndex + 1).Weeks

End Sub
-------------

Cheers

Deleting Entries From Access
I am working on an access database that runs through VB. What I am wondering is, The ID is set to auto number so the Data Type is automatically set to Long Integer. If the users are constantly deleting entries from the database, will they get an error if the ID number reaches 2,147,483,647?
Thats all I need to know.

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.

Deleting Entries In A Label
Hi,

can anyone help? This is college work.

I have a label that is updated with the value of a text box when I click on a command button (CmdAdd).

What I can't do is be able to delete the entry from the Label if it matches the value in the Text Box when I click on Cmdremove.

Code:

Dim Number(20) As Integer
Dim I As Integer

Private Sub CmdAdd_Click()
Number(I) = TxtNumber.Text
LblNumber.Caption = LblNumber.Caption & Str(Number(I)) & vbCrLf
End Sub

Private Sub CmdRemove_Click()


Thanks

Deleting Old Text Files
I have a program that generates a report, saves them to a directory (just in case), then emails it out to a specified list. What i'd like to do is delete the files that are more than a week or so old. I did some searching and found this script but i get an error.


VB Code:
Dim ofile As File    Dim ofolder As Folder    Dim ofso As FileSystemObject    Set ofso = New FileSystemObject    Set ofolder = ofso.GetFolder("C: emp")    [hl=#FFFF99]For Each ofile In ofolder[/hl]        If DateDiff("d", ofile.DateCreated, Now) > 7 Then            If Mid(ofile.ShortName, InStrRev(ofile.ShortName, ".")) = ".txt" Then                ofile.Delete False            End If        End If    Next       Set ofile = Nothing    Set ofolder = Nothing    Set ofso = Nothing


The error i get is on the highlighted line. The Error i get is a message about object does not support this property or method.

Thanks
Andy

Deleting Text Files
How would I delete a text file...

Anyone?

Anyone at all?

Please post code, if possible...

Thank You

How Double Click The Text File From Files Explore Then Open And Edit It???
Dear Sir..

I write a simply Text editor program and add a file extension.
although program will automatically launch after i double click the
files from files explore, but i don't know how to open and read the
file content that i double click on.

just like...

open "abc.txt" for input as 1#
^^^^^^^^^ <- how do i change this filename as i double click file from the files explore...

this problem confuse me for a long time.... if you know hope you
can help me... thank a lot...

Best Regards
ART

How Double Click The Text File From Files Explore Then Open And Edit It???
Dear Sir..

I write a simply Text editor program and add a file extension.
although program will automatically launch after i double click the
files from files explore, but i don't know how to open and read the
file content that i double click on.

just like...

open "abc.txt" for input as 1#
^^^^^^^^^ <- how do i change this filename as i double click file from the files explore...

this problem confuse me for a long time.... if you know hope you
can help me... thank a lot...

Best Regards
ART

PropBag Problems (deleting Entries)
Hi!

I've got a slight problem with my application: I'm saving 'files' to a propertybag, which works fine but I don't seem to be able to delete entries

Edit: File is saved in a propertybag... Just has the name in it (like: 'test.dat' and all
ValidFilename just checks the filename and it works fine so there is no problem there

Code:

Code:
Private FileBag As New PropertyBag
Public Function GetFileContent(Filename As String, Optional BIGFile As String = "files.big") As String
On Error GoTo ErrHandler
Dim var As Variant
Open BIGFile For Binary As #1
Get #1, , var
Close #1
FileBag.Contents = var
'FileBag is set...
'Check for valid filename!
If ValidFileName(Filename) Then
GetFileContent = FileBag.ReadProperty(Filename)
End If


Exit Function
ErrHandler:
ShowErr Err.Number, Err.Description, "FileSystem_GetFileContent"
Resume Next
End Function
Public Function SetFileContent(Filename As String, FileValue As String, Optional BIGFile As String = "files.big") As Boolean
On Error GoTo ErrHandler
Dim var As Variant
Open BIGFile For Binary As #1
Get #1, , var
Close #1
FileBag.Contents = var
'FileBag is set...
'Check for valid filename!
If ValidFileName(Filename) Then
If FileBag.ReadProperty(Filename, "") <> "" Then
'Already exists
ShowErr 999, "File already exists", "FileSystem_SetFileContent"
SetFileContent = False
Else
FileBag.WriteProperty Filename, FileValue
SetFileContent = True
End If
Else
ShowErr 999, "Wrong filename", "FileSystem_SetFileContent"
End If
var = vbNullString
var = FileBag.Contents
Open BIGFile For Binary As #1
Put #1, , var
Close #1

Exit Function
ErrHandler:
ShowErr Err.Number, Err.Description, "FileSystem_SetFileContent"
Resume Next
End Function
'Error occurs in this function (DeleteFile)
Public Sub DeleteFile(Filename As String, Optional BIGFile As String = "files.big")
On Error GoTo ErrHandler
Dim var As Variant
Open BIGFile For Binary As #1
Get #1, , var
Close #1
FileBag.Contents = var

FileBag.WriteProperty Filename, ""

var = FileBag.Contents

Open BIGFile For Binary As #1
Put #1, , var
Close #1

MsgBox GetFileContent(Filename, BIGFile)

Exit Sub
ErrHandler:
ShowErr Err.Number, Err.Description, "FileSystem_SetFileContent"
Resume Next
End Sub

Thanks in advance,

Kalkran

Deleting Selected Entries From A Flexgrid
i have an mshflexgrid whose datasource is an ado connection. how can i make it so that a user can select an entry and press a button to delete it from the database? ive gone through flyguys functions and i cant see what i want.

Deleting Empty Entries In A List Box
I want to find and delete all of the entries in a list box containing only " " and nothing else

i use this code


VB Code:
dim n as integerfor n = 1 to list1.listcount       if list1.list(n) = " " then           list1.removeitem n       end ifnext n



i get a "invalid procedure call or argument" error, and it highlights the "list1.removeitem n" line of the code.

how do i do this the right way?

Deleting Sentences In Text Files
How do you only delete certain parts/lines/sentences in a text file?

Deleting Opened Text Files.
If inside my code, I opened a text file using

Open "a.txt" for Input at #1

How do I erase the file if I decided to cancel the operation after this statement and before the Close #1?

Deleting Registry Entries, Ip Address Change
This is my first post and i only know a little about vbs so here it goes.

I need to delete some entries in the registry, can this be done? I did a google search and came up with nothing.

I also need to change an ip address for my home adsl because when i go into school the ip is assigned on my laptop by the dhcp server, which means i can't use the adsl at home unless i do ipconfig/release and then renew which is a real hassle.

I have been playing around with adding and removing printers and that has worked, but this is outa my league.

Thanks in advance

Jon

Deleting Entries That Is Older Than 90 Days From A Database.
Hello,

I would like to delete entries older than or is 90 days with just one click from my app.

Used: dbObject.execute "Delete * from myTable where RegDate <= " & format$(date - 90, "dd.mm.yy") . But it did not work.

Can anybody help pleaseeeeee................... ?


Thanks


VbBoy.

Deleting Entries In Excel And Other Small Stuff
How do I delete an entry within Excel. Also, how can I make a word document appear from within VB. Lastly, how can I add the numbers of 4 text boxes, when I try to add 1,1,1,1 I get 1111, not 4. It seems like it should be very simple, but I can't do it. Any help would be greatly appreciated.

Thank You,
Ezudin

Deleting Specific Lines From Text Files
lo again,

what i need to do is search through a particularly short text file and upon finding a specific word at the beginning of a line, deleting the whole line entirely.
the specific word will be entered from a text box if that is of any help?

thanks a lot

sidewinder

---im a n00b, dont hurt me---

Listing Entries In A Combo Box [SOLVED]
Hi folks

Yet another block steps infront of me. In a combo box you would expect the list to list underneath the first entry. In my case this doesn't happen.

I have a list of 4 things in a database. I have entered in the necessary data and put a data control my form etc

Now when I link the combo box to the database it lists the first entry which in my case is france but to get to Senegal, Denmark and Uruguay you have click on the arrow head next to Data1 (This is the long thing called a Data Control if you didn't know already)

Tell me why it won't list them in a combo box.



Thanks again folks you are all wonderful people

Deleting Double Duplicates
Does any one know how I might change the following code so thatit looks at two cells in a row for duplicates not just one? This code will look in the selected column and find duplicates in that column and delete the whole row when it finds them.
I'd like to look at two cells in a row, a and b If they are identical to another row I'd like to delete both rows.
So for example

12345 56
12345 75
98765 100
98765 100

So it would see that 12345 and 12345 match, but ignore it because col bs 56 and 75 dont
It would see that 98765 and 98765 match and delete both rows because col bs 100s also match?
The code I have which does half of it is

<CODE>
DeleteDuplicateRows
This macro will delete duplicate rows in a range. To use, select a single-column range of cells, comprising the range of rows from which duplicates are to be deleted, e.g., C2:C99. To determine whether a row has duplicates, the values in the selected column are compared. Entire rows are not compared against one another. Only the selected column is used for comparison. When duplicate values are found in the active column, the first row remains, and all subsequent rows are deleted.
Public Sub DeleteDuplicateRows()
'
' This macro deletes duplicate rows in the selection. Duplicates are
' counted in the COLUMN of the active cell.

Dim Col As Integer
Dim r As Long
Dim C As Range
Dim N As Long
Dim V As Variant
Dim Rng As Range

On Error GoTo EndMacro
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

Col = ActiveCell.Column

If Selection.Rows.Count > 1 Then
Set Rng = Selection
Else
Set Rng = ActiveSheet.UsedRange.Rows
End If

N = 0
For r = Rng.Rows.Count To 1 Step -1
V = Rng.Cells(r, 1).Value
If Application.WorksheetFunction.CountIf(Rng.Columns(1), V) > 1 Then
Rng.Rows(r).EntireRow.Delete
N = N + 1
End If
Next r

EndMacro:

Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

End Sub
:
<CODE>

Show ToolTipText Inside Listbox On Long Entries SOLVED!!
For those trying to show ToolTipText on long listbox entries while form's ScaleMode is set to Pixel AND as long as form's Autoredraw being set to False isn't a problem THEN this will work.
BTW, thanks to Hack for his input

VB Code:
Option ExplicitPrivate Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Integer, ByVal wParam As Integer, lParam As Any) As Long Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long ' to displays tooltiptext when over listbox itemPrivate Const SM_CXHTHUMB = 10 Private Const LB_ITEMFROMPOINT = &H1A9   Private Sub List1_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)Dim MousePos  '[color=red]will return Overflow message if Dim As Long or As Integer. why ??[/color]Dim PositionX As LongDim PositionY As Long'the SendMessage API will not accept values declared As Single, therefore, the X and Y'portions of the MouseMove parameters have to be converted to a Long.   Also, a ListBox'control maintains its X/Y position in twips.   SendMessage does not understand twips,'therefore, X/Y must be converted to pixels.PositionX = CLng(x / Screen.TwipsPerPixelX)PositionY = CLng(Y / Screen.TwipsPerPixelY)'MousePos will contain the index of the the ListBox itemMousePos = SendMessage((List1.hWnd), LB_ITEMFROMPOINT, 0, ByVal ((PositionY * 65536) + PositionX)) With List1             'the If statement next is necessary to ensure that the mouse is             'over a valid list box entry.             If (MousePos >= 0) And (MousePos <= .ListCount - 1) Then             If TextWidth(.List(MousePos)) >= .Width - CInt(GetSystemMetrics(SM_CXHTHUMB)) Then                 .ToolTipText = .List(MousePos)            Else                 .ToolTipText = ""            End If        Else            .ToolTipText = ""        End If    End WithEnd Sub

Deleting Text Files Or Text From Files!
If you've never used the Kill statement before, the following are needed for this to work properly :The Path to the fileThe full file (the extension is important here)The string of the file must be enclosed with double quotesSo, for the above :

Code:
Kill "c:my documentsfile.txt"

Should do the trick.
The following will check if the file exists, if it's open, then will kill it :

Code:
Select Case Len(Dir$("c:my documentsfile.txt"))
Case 0
Msgbox "Where'd it go - no file found here !"
Case Else
If (Open "c:my documentsfile.txt" for output as #1) = 0 then
Msgbox "The file's already open, what're you playing at ?"
Else
Close #1
Kill "c:my documentsfile.txt"
End If
End Select

Double Msgbox **SOLVED**
Can anyone tell me why the messagebox needs to be closed twice when anything other than a numeric value is inputed into the text10.text.

For some reason the messagebox pops up twice.


Private Sub Text10_Change()

If Not IsNumeric(Text10.Text) Then
Text10.Text = ""
message = "Please only use Numeric values"
MsgBox (message), , "Numbers Only"
End If

End Sub



Thanks

Double Paste Into RichTextBox When Ctrl+V Pressed (1/2 Solved)
I have RichTextBox and a menu, under the menu, one of the item is "Paste" with shortcut key of Ctrl + V.
This is the code,
Code:
Private Sub mnuEditCopy_Click()
    Clipboard.Clear
    Clipboard.SetText rtfBody.SelRTF, vbCFRTF
End Sub
Private Sub mnuEditPaste_Click()
    rtfBody.SelRTF = Clipboard.GetText(vbCFRTF)
End Sub

If I press the "Paste" from the menu, it works fine.
However, if i press Ctrl + V, it will paste the selected word(s) twice.

I tried to do something like the following,
Code:
Private Sub mnuEditPaste_Click()
    rtfBody.SelRTF = Clipboard.GetText(vbCFRTF)
    rtfBody.SelRTF = "X"
End Sub

If I selected some words, for example, 1234.
Pressing the PASTE from menu, it will paste 1234X
Pressing Ctrl+V, it will paste 12341234X

It seems like when pressing Ctrl+V, Windows OS pastes for me first, and then my program calls the mnuEditPaste_Click().

But, if I use text box instead of rich text box (SelRTF becomes SelText, and no "vbCFRTF"), it won't double pasting.

Does anyone know what's going on? Thank you!



Edited by - seleven on 10/19/2003 9:08:54 AM

Double Data Type Binary Representation In Memory [Solved]
Hi Folks
does anyone know how vb 6 double data type in represented in memory
ex what 3FFF0000h means



Edited by - Rashad on 2/26/2006 7:46:07 AM

Re: Securely Deleting A File !! ** SOLVED **
Hi,
 I was wondering what is the best way to delete afile securely.
I think there are many Undeleters which will trace back a file even after deletion.

Is there any way to securely delete a file which cannot be retreived back ??

I was thinking of saving the file with many cycles of random bytes and then deleting it.

Is it the secure way or is there any other good way available ????

Thanks in advance !!

Regards

Er. Gurpreet Singh
C.E.O Sukhmani Software
New Delhi


Difficult Things are Those that can be done Instantly.

Impossible things are those which take little long - Unknown

Edited by - gurpreet2311 on 4/20/2004 10:23:18 AM

Deleting Folders And Subswhich Would Means Been Solved Again
How do you do something like:


VB Code:
Private Sub Command1_Click()'  abc is the name of folderKill "c:abc*.txt"End Sub


except it would search abc and all of its subfolders for *.txt or whatever extension.

SOLVED Deleting " From My Sequencial File
Hello friends:

I need to read a sequential file and replace the " with nothing. I know hot to use the replace function with text boxes and similar controls but, how do I use something like it with a file?

I wrote a .csv file with some info inside. This file will be used by an external app but the file ca not contain any ".

This is a sample of the file my app generates when it reads another huge sequential file:

(Asume FileName.sys as the name of the file it is always in App.Path. I only need a sample on how to get rid of the " so the name and the location of the file are nos necessary and I provide it for your info.)

Original file:
"022","Name Goes here","3/20/2005","6:15 AM","3:00 PM"
"025","Name Goes here","3/20/2005","6:00 AM","3:02 PM"
"030","Name Goes here","3/20/2005","6:10 AM","3:10 PM"
"075","Name Goes here","3/21/2005","6:00 AM","3:00 PM"
"422","Name Goes here","3/22/2005","6:05 AM","3:08 PM"

Now I need to write the file this way:
022,Name Goes here,3/20/2005,6:15 AM,3:00 PM
025,Name Goes here,3/20/2005,6:00 AM,3:02 PM
030,Name Goes here,3/20/2005,6:10 AM,3:10 PM
075,Name Goes here,3/21/2005,6:00 AM,3:00 PM
422,Name Goes here,3/22/2005,6:05 AM,3:08 PM

Can anyone help me? Please, this is the only stage of development that is slowing me down (for now). Any help will be appreciated.

Thnx,





Edited by - ZepolSys on 4/12/2005 10:59:22 AM

Adding Entries To Txt Files
i need to be able to add entries to atxt file, but every time i do this it overwrites the last entry (i.e. i can only get one entry at a time how can i make the txt file have multiple entries and the computet to be able to read them.

Listbox, Files Reg Entries, + Stuff.
Yo every1
ok. i wanna make a prog that lets u view pictures. but i want 2 store all the pics names in a combo box. i want to b able 2 store the pictures file name inside a variable,the idea being that i can call the pictures variable number, eg 1, and the add .filename or .picturename or whatever, but im not sure how 2, or even if its possible. i also want 2 let ppl add new pics, and store the new pics names and file in the reg.
any ideas?
Ta.

------------------
jimmy
ICQ:35813919
jim@rdalby.f9.co.uk


[This message has been edited by jimdalby (edited 01-13-2000).]

Reading MS Addres Book Entries (wab Files)
I usually post questions nobody knows how
to answer! I hope this is not one of them:

I would like to read email addresses from outlook express's address book. It is stored in a wab file.

And BTW, why is search disabled?

Running Batch Files And Registration Entries
I need to install a dll for a GIS application. Part of the installation requires running a MS-DOS batch file (.bat) to register the dll and a registration entry file (.reg) to register components of the dll in the GIS software's component categories. Has anyone ever ran either of these files through VB? I've tried using the shell function, but that only seems to work with executables.

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?

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?

Double Files?
Does anyone know how to recall {Call ListFiles ("srmapp")} Without displaying the same file twice?

Here's my code:


Code:

Private Sub Form_Load() ' Loads Form Components
Call ListFiles("srmapp")

End Sub

Private Sub mnuViewFiles_Click()

Dim strArray() As String
Dim myfile As String
Dim MyPath As String
Dim strflist As String
MyPath = "srmapp"
myfile = mnuViewFiles

'Call ListFiles("srmapp")



Open MyPath & myfile + ".srm" For Binary As #1
strflist = Space(LOF(1))
Get #1, , strflist

txtProgram.Text = strflist

Close #1
If Len(strflist) > 0 Then
txtProgram.Text = strflist

End If

strArray = Split(strflist, vbCrLf)
txtProgram.Text = strArray(0)
txtName.Text = strArray(1)
txtMail.Text = strArray(2)
txtSerial.Text = strArray(3)

End Sub

Public Function GetFolderName(DialogTitle As String) As String
Dim iID_List As Long
Dim sBuffer As String
Dim BrowseParams As BrowseInfo

GetFolderName = vbNullString

With BrowseParams
.hWndOwner = hwnd
.lpszTitle = lstrcat(DialogTitle, vbNullString)
.ulFlags = BIF_RETURNONLYFSDIRS
End With

iID_List = SHBrowseForFolder(BrowseParams)

If (iID_List) Then
sBuffer = Space(MAX_PATH)
SHGetPathFromIDList iID_List, sBuffer
GetFolderName = NormalizePath(StripNullChars(sBuffer))
End If

End Function

Private Sub ListFiles(sFolder As String)
Dim i As Integer
Dim sFilename As String
Dim iCount As Integer
Dim FSO As New FileSystemObject

iCount = 1

' Remove flags for files you don't want to include

sFilename = Dir(FSO.BuildPath(sFolder, "*.*"), vbNormal Or vbHidden Or vbSystem Or vbReadOnly)
sFilename = Left(sFilename, InStrRev(sFilename, ".") - 1)

On Error Resume Next

Do
sFilename = Dir() ' Get next filename
If Trim$(sFilename) = vbNullString Then Exit Sub
sFilename = Left(sFilename, InStrRev(sFilename, ".") - 1)
mnuViewFiles.AddItem sFilename 'Substitute Combo1 with the name of your combo box
iCount = iCount + 1
Loop

End Sub
Private Function NormalizePath(sFolder As String) As String

sFolder = Trim$(sFolder)

If Right$(sFolder, 1) <> "" Then sFolder = sFolder & ""
NormalizePath = sFolder

End Function
Private Function StripNullChars(sString As String) As String
Dim iPos As Integer

' Strips the null terminator from the end of a string.
' Usually used with API returns such as GetWinSysDir

' Strip leading nulls
Do While Left$(sString, 1) = vbNullChar
sString = Right$(sString, Len(sString) - 1)
Loop

' Strip trailing nulls
iPos = InStr(sString, vbNullChar)
If iPos > 0 Then
StripNullChars = Left$(sString, iPos - 1)
Else
StripNullChars = sString
End If

End Function

Recusively Deleting Files/files Within Subfolders Using FSO
Hi. I'm relatively new to VB, and the FSO is a totally new subject to me. I'm writing a program that is somewhat like Disk Cleanup, but lets the user choose the folders to clean. I've tried using a sub called 'Nuke', that I found somewhere on the MSDN site, but it only deletes files on the OS' drive. I have a function which uses the FSO to recursively set the files' attributes, which works fine even on the other drives, so I figured there must be a way to delete them using the same method. Any help would be appreciated, 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

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