[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

Edit Data from text file

Asked by Sabrin in Visual Basic Programming

Hello,
I have a text file with a name of domain and source of html, I would like to have a button
that can edit the data from the text file! what I have been using is a button (save as new) and then
clicking on (delete) is it possible to add an (edit) button to this code?

Option Explicit
Dim FSO As Object

Private Sub Form_Load()
    Dim TS As Object
    Dim i As Long
    Dim sContent As String
    Dim vRows, vCells
     
    Set FSO = CreateObject("Scripting.FileSystemObject")
    If Not FSO.FileExists(App.Path & "\names.txt") Then
        Set TS = FSO.CreateTextFile(App.Path & "\names.txt")
    End If
   
    Set TS = FSO.OpenTextFile(App.Path & "\names.txt")

If TS.AtEndOfLine Then
   TS.Close
   Set TS = Nothing
   Exit Sub
End If

    sContent = TS.ReadAll
    TS.Close
   
    vRows = Split(sContent, vbCrLf)
    For i = 0 To UBound(vRows)
        vCells = Split(vRows(i), "**!!**")
        If UBound(vCells) >= 0 Then ListBox1.AddItem (vCells(0))
    Next
    If ListBox1.ListCount > 0 Then ListBox1.ListIndex = 0
End Sub

Public Sub ReloadINI()
    ListBox1.Clear
    Call Form_Load
End Sub

Private Sub ListBox1_Click()
    Populate (ListBox1.ListIndex)
End Sub

Public Sub Populate(ByVal Record As Long)
    Dim FileNo As Long
    Dim strLine As String
    FileNo = FreeFile()
    Open App.Path & "\names.txt" For Input As #FileNo
    Dim intRecord As Long
    For intRecord = 0 To Record
       If Not EOF(FileNo) Then
           Line Input #FileNo, strLine
       End If
    Next
    Close #FileNo

    Dim values As Variant
    values = Split(strLine, "**!!**")
    If UBound(values) >= 1 Then
        txtDomain = values(0)
        txtSource = values(1)
    End If
End Sub

Private Sub cmdDelete_Click()
    Dim TS As Object
    Dim sContent As String
    Dim vRows
    Dim i As Long
   
    If ListBox1.ListIndex <> -1 Then
        Set TS = FSO.OpenTextFile(App.Path & "\names.txt")
        sContent = TS.ReadAll
        TS.Close
        vRows = Split(sContent, vbCrLf)
       
        sContent = ""
        For i = 0 To UBound(vRows)
            If i <> ListBox1.ListIndex And vRows(i) <> "" Then sContent = sContent + vRows(i) + vbCrLf
        Next
       
        Set TS = FSO.OpenTextFile(App.Path & "\names.txt", 2)
        TS.Write (sContent)
        TS.Close
       
        ListBox1.RemoveItem (ListBox1.ListIndex)
       
        SetFocus
        Call ReloadINI
    End If
End Sub

Private Sub cmdSave_Click()
Dim FileNo As Integer

FileNo = FreeFile
Open App.Path & "\names.txt" For Append Shared As #FileNo
Print #FileNo, Replace(txtDomain.Text & "**!!**" & txtSource.Text, vbCrLf, " ")
Close #FileNo

SetFocus
Call ReloadINI
End Sub

Private Sub cmdEdit_Click()
    'edit button needed
End Sub
[+][-]06/29/07 11:30 AM, ID: 19392434Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Visual Basic Programming
Sign Up Now!
Solution Provided By: PaulHews
Participating Experts: 3
Solution Grade: A
 
[+][-]06/29/07 04:35 AM, ID: 19388419Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/29/07 04:55 AM, ID: 19388537Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/29/07 05:10 AM, ID: 19388621Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/29/07 07:00 AM, ID: 19389702Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/29/07 07:55 AM, ID: 19390271Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/29/07 08:21 AM, ID: 19390561Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/29/07 08:26 AM, ID: 19390599Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/29/07 09:25 AM, ID: 19391332Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/29/07 10:26 AM, ID: 19391845Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/29/07 11:25 AM, ID: 19392386Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/29/07 11:26 AM, ID: 19392393Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/29/07 11:32 AM, ID: 19392452Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/29/07 11:35 AM, ID: 19392477Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/29/07 11:36 AM, ID: 19392485Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091118-EE-VQP-93