Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Visual Basic .NET (http://www.programmingforums.org/forum19.html)
-   -   File Beakpoints/Sections? (http://www.programmingforums.org/showthread.php?t=12498)

bigguy Feb 3rd, 2007 8:43 AM

File Beakpoints/Sections?
 
Hey yall. Right now, I'm making a program that you can make "admins" for the program, (not the computer admins). So what I was wondering is. Is there a way I can make sections, or breakpoints in a file, so when a new admin is created it wont overwrite the existing Admin(s). The is the layout I want kind of.

Admin Settings
Admin1
Username = Seth
Password = Hall
------------------------------------------- <<<Breakpoint
Admin2
Username = bigguy
password = smallbody
-------------------------------------------<<<Breakpoint

Just something like that. As long as it can keep them separate from each other, while they are in the same file. If it is possible how also can you look at specific sections, so when they login, I can see if they provided credentials match any of the file sections?

One more thing, the other day I was trying to code something to save computer logs to. So I used this
file.writealltext(my.computer.info.directorypath & "Logs for " & date.now & ".txt"

and I got a IO Exceptions. Any ideas where I can still use this format and it work?

Wizard1988 Feb 3rd, 2007 10:26 AM

You don't need breakpoints, just use some kind of a delimiter and append to the file.

bigguy Feb 3rd, 2007 1:38 PM

Thanks for the reply. Can you maybe show me a example of delimiting a file, I don't know how. Or just point me to a good tutorial. Thanks again.

Arevos Feb 3rd, 2007 2:12 PM

Seems to me like XML serialization would be your best bet in this case. You can set up a class, mark it with certain attributes, and automatically have it translated to and from XML. Here's a C# article on it. VB.NET works the same way, but I believe attributes in VB use <> rather than [].

Wizard1988 Feb 3rd, 2007 2:35 PM

By delimiter I ment that you should just have some symbol that would mean that its the end of one entry.

For example:

Admin Settings
Admin
Username = Seth
nimdA
Admin
Username = bigguy
password = smallbody
nimda

When you read the file you would look for those strings and you would know where the beggining and end are.

However you might want to go with XML.


All times are GMT -5. The time now is 12:52 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC