Results 1 to 3 of 3

Thread: [2005]

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2008
    Posts
    7

    [2005]

    Hi,all

    What i am trying to do now is to show the content of the dnsredir.ini file on the forms and able to edit it.

    The dnsredir.ini file file looks like this

    ;Configuration INI file for DNS Redirector v6.4.7

    Logging=Normal

    ListenOnIP=172.23.128.33

    DNSServerIP=172.122.16.98

    SimpleDNS=

    RedirectIP=
    AuthKeywordsFile=
    AlwaysKeywordsFile=always.txt
    AuthClientsFile=

    BlockedIP=172.26.128.33
    BlockedKeywordsFile=blocked.txt
    AllowedKeywordsFile=allowed.txt
    BypassBlockFile=bypassblock.txt

    RestrictIP=
    RestrictStart=
    RestrictEnd=
    BypassRestrictFile=

    ActionNumber=0
    JoinType=Detect
    JoinAction=
    LeaveAction=

    ClientTimeout=20

    MinToTray=False
    CloseToTray=False

    ;Save this INI then close and restart dnsredir.exe so changes become active

    I need to be able to read the file and edit it line by line.. for example

    ListenOnIP=172.26.128.33 is on line 5.
    I need to be able to edit 172.26.128.33 on line 5
    and when i click save it will be save on the same line in the .INI file.

    I think i need to use array or something but I am very new to Vb. I seriously need help! Please Help with the coding. Thanks!!!!

  2. #2
    Fanatic Member Mr.No's Avatar
    Join Date
    Sep 2002
    Location
    Mauritius
    Posts
    651

    Re: [2005]

    Have a form with a single textbox and set it multiline. Use the ReadAll (or ReadToEnd) method of the FileStream to read the whole file as a string and display in the textbox. Edit and save.
    Using VB.NET 2003/.NET 1.1/C# 2.0
    http://del.icio.us/rajoo
    Blow your mind, smoke gunpowder
    Ashes to ashes, dust to dust
    If God won't have you, the devil will. - Author unknown
    Don't follow me, I'm lost too ...

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005]

    IO.File.ReadAllText and IO.File.WriteAllText for reading and writing the file.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width