Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If your project is named "My Project" then go to the menu

Project -> MyProject Properties...

It will be the last or next to last item. You'll see a page of property settings. There will be a vertical stack of categories such as Application, Compile, References, etc. Click on the one named "Settings".

Enter a name for the settings variable, as well as a datatype and scope. If you pick User scope, each logged on user will get their own copy. If you pick "Application" then all users will share the same copy. You can also set an initial value to be used when the app is used for the first time.

The code to load the value at startup goes in the Form_Load sub as in

Public Class Form1

    Private nextNum As UInteger

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        nextNum = My.Settings.NextNumber

    End Sub

To save the last used value put the code ini the Form_Closing event as in

    Private Sub Form1_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing

        My.Settings.NextNumber = nextNum

    End Sub
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Let me know how it goes. I had to avoid interlocks on many different automated processes that could not respond to pop-ups. It can get tricky.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Nobody got "I'm the son of a seacook"?

Arsenic and Old Lace.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You can save the last used number in a settings variable. If you go to your project properties (see Project menu), then go to the Settings tab, you can add a settings variable of any time and scope. If the numbers are unique for each user then create a User scope variable. If the numbers are unique for all users then create an Application scope variable.

Let's assume you create an integer variable named NextNumber and give it a starting value of 1. You can load the value when the application starts by

Dim nextNum As Integer = My.Settings.NextNumber

And you can save the newest setting on form close by

My.Settings.NextNumber = nextNum

and you can convert nextNum to a zero-padded string by

nextNum.ToString("000000000")
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

When pulling an "all-nighter" means not having to get up to pee.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It's been a few years since I've had to do this and I don't have access to an FTP site to test. Let me install the FTP service locally and I'll write up a test script. I'll get back to you after the mens' final at Wimbledon.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Every time I go to the vb.Net forum, two articles keep getting flagged as new even though I have viewed them and tried clicking "Mark Forum Read". The articles are here and here. They haven't been updated in two days but I was in both threads twice yesterday.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

An excellent document on printing can be found here

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I usually see an optician for an eye test, but I do have the choice of seeing an opthalmologist. We are covered for one eye test every two years. A few years ago I started seeing vertical black streaks in one eye, sort of like what you would see on a really old black and white movie that had been screened too many times. I also got flashes of light when lookling left or right (same eye). I got in tot he opthalmologist within an hour. After a thorough exam (which was repeated several times over the next week) they determined that it was normal. As the retina ages it shrinks and this can occasionally cause temporary symptoms like I was getting. They went away and haven't returned. These examinations were also covered.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You could just use the command line ftp.exe with a script file that logs in and lists the directory and pipe the output to a file.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

They say don't ask the barber if you need a haircut. I never get my eyes checked at a place that also sells lenses.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Slap some bacon on a biscuit and let's go! We're burnin' daylight

The Cowboys (John Wayne)

"I'm the son of a seacook!"

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Looks like prefilter was the thing. As it turns out, I only really need to trap the mouse enter. Thanks again.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

@Krod - Thanks for the suggestion but because the buttons completely fill the TableLayoutPanel, the panel never gets to trigger.

@TNTinMN - Also thanks. I think the prefilter is the way to go, however, I'll need to do a little research to figure out the finer points.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I find books much easier to read when ideas are broken down into paragraphs and chapters. A great deal of research has been done on effective presentation and has determined the same thing for both books, newspapers and web pages. Monolithic blocks of text are harder to comprehend. The same holds true, in general, for code.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I have a form that consists of only a TableLayoutPanel (which fills the entire form) containing a vertical stack of buttons. The resulting app is used in conjunction with another app. What I would like is to have the vb app do something when the mouse enters the form. Unfortunately, all mouse enter/leave events are trapped by the panel or the buttons.

As a quick test I created a form with a tablelayoutpanel (docked to fill the form) containing one button. I added the following code:

Private Sub Form1_MouseEnter(sender As System.Object, e As System.EventArgs) Handles MyBase.MouseEnter
    Debug.WriteLine("enter form")
End Sub

Private Sub Form1_MouseLeave(sender As System.Object, e As System.EventArgs) Handles MyBase.MouseLeave
    Debug.WriteLine("leave form")
End Sub

Private Sub TableLayoutPanel1_MouseEnter(sender As System.Object, e As System.EventArgs) Handles TableLayoutPanel1.MouseEnter
    Debug.WriteLine("enter panel")
End Sub

Private Sub TableLayoutPanel1_MouseLeave(sender As System.Object, e As System.EventArgs) Handles TableLayoutPanel1.MouseLeave
    Debug.WriteLine("leave panel")
End Sub

Private Sub Button1_MouseEnter(sender As System.Object, e As System.EventArgs) Handles Button1.MouseEnter
    Debug.WriteLine("enter button")
End Sub

Private Sub Button1_MouseLeave(sender As System.Object, e As System.EventArgs) Handles Button1.MouseLeave
    Debug.WriteLine("leave button")
End Sub

There was no way of moving the mouse around that caused the form's mouse enter or leave events to fire. Is there anything (perhaps similar to KeyPreview) that lets me see the mouse enter/leave events at the form level? I could always add a common Mouse_Enter event to each button (all buttons are created at runtime) but this seems like a crude way to do it.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you change your ini file format to the above then you can simplify the code to

Public Class Form1

    Private Accounts As New List(Of Account)

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        ReadAccounts("d:\temp\silkroad.txt", Accounts)
        WriteAccounts("d:\temp\silkroad.txt", Accounts)
    End Sub

    Private Sub ReadAccounts(filename As String, Accounts As List(Of Account))

        For Each line As String In System.IO.File.ReadAllLines(filename)
            Accounts.Add(New Account(line.Split(",")))
        Next

    End Sub

    Private Sub WriteAccounts(filename As String, Accounts As List(Of Account))

        Dim lines As String = ""

        For Each acct As Account In Accounts
            lines &= acct.ToString() & vbCrLf
        Next

        System.IO.File.WriteAllText(filename, lines)

    End Sub

End Class

Public Class Account

    Public Version As String
    Public Login As String
    Public Username As String
    Public Password As String
    Public Character As String
    Public Server As String
    Public ReturnLogin As Boolean
    Public LoginStart As Boolean
    Public RelogDisco As Boolean
    Public DisMap As Boolean
    Public SpecialAcc As Boolean

    Public Sub New(fields() As String)
        Me.Version = fields(0)
        Me.Login = fields(1)
        Me.Username = fields(2)
        Me.Password = fields(3)
        Me.Character = fields(4)
        Me.Server = fields(5)
        Me.ReturnLogin = fields(6) = "True"
        Me.LoginStart = fields(7) = "True"
        Me.RelogDisco = fields(8) = "True"
        Me.DisMap = fields(9) = "True"
        Me.SpecialAcc = fields(10) = "True"

    End Sub

    Public Overrides Function ToString() As String

        Return Me.Version & "," &
                Me.Login & "," &
                Me.Username & "," &
                Me.Password & "," &
                Me.Character & "," &
                Me.Server & "," &
                IIf(Me.ReturnLogin, "True", "False") & "," &
                IIf(Me.LoginStart, "True", "False") & "," &
                IIf(Me.RelogDisco, "True", "False") & "," &
                IIf(Me.DisMap, "True", "False") & "," & …
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I tried to reproduce the problem in Internet Explorer 10 and couldn't. It happens only in FireFox. But it happens in FireFox consistently. If I type until I fill up the initial edit window everything is fine. As soon as I type the final character in the initial window things go funny. If you think it would help narrow down the problem you are welcome to remote in with TeamViewer and see for yourself. edit1

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I cleared the cache (even used ccleaner) and got exactly the same problem in the same area.

Also, I had to post this twice to get it to show up.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I had the cursor offset problem an hour or so ago. I started typing this post and noticed that the cursor started having the same problem in this post. I tried re-entering all of the text to see if I could determine where the problem was occurring but I couldn't make it - OK. It happened as soon as the edit window expanded by one line to accomodate the extra text. It gets worse for every new line that gets expanded. I'm using Firefox 13.0.1.

I'm trying to upload a screen cap but when I click on "Files" I got the "Upload Attachments" area but no actual area to specify a file. I'll try to save, then add an attachement with an Edit. edit

It doesn't show up in the screen cap, but the cursor is actually between "b" and "ut" on the last line.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It converts information from hundreds of Excel documents into a few small text files

Let's assume your Excel files are named ss-0001.xls, ss-0002.xls, etc.

I'm guessing you have two processes at work here. One process runs independently of the GUI app and renders many Excel files into a few text files. This process runs whenever an Excel file is updated.

The second process is run by the user(s) and is used to load and update the Excel files. Let's assume two users modifying files ss-0001.xls and ss-0002.xls. User1 saves ss-0001.xls causing the generation of text files. User2 tries to save ss-0002.xls while the generator is reading it. This could be one source of the interlock.

One suggestion is that when user1 selects an Excel file for editing, that files is copied into a temporary file with a name like

ss-0001-user1.xls

All edits are done on the user specific version of the files. That way the generator can use only the non-user specific files. When the user wants to save the file, the changes get saved to the temp file. Once the file has been written, the save code then enters a loop that repeatedly tries to delete the original file. Once successful it then renames the temp file to the original name.

save temporary spreadsheet

do until original file deleted
    sleep for a short time
loop

rename temp file to original name

The file system watcher would be triggered on the appearance of the …

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Perhaps we are going about this the wrong way. You started out by deciding that you should use the APIs (and interface code) for reading/writing ini files, but that may not be what you need based on the type on information you are trying to save/restore. Ini files typically deal with more or less fixed sections and parameters rather than variable length sections. Your situation is more like a recordset (a repeating number of similar records). Maybe we should take another look at a custom read/save class. Then your ini file would look like

Silkroad International,Random,user1,pass1,char1,Aquarius,False,False,False,False,False
Silkroad International,Random,user2,pass2,char2,Aquarius,False,False,False,False,False
Silkroad International,Random,user3,pass3,char3,Aquarius,False,False,False,False,False
.
.
.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

and the ini file looks like?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

What is "DomainUpDown"? Can you please post the current working contents of your ini file? The statement

My.Computer.FileSystem.ReadAllText(INIFileR).Split()

will read the entire ini file and split it into tokens at each blank. I don't think this is what you want.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

need --> coffee

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

From the pen of Ashleigh Brilliant

Mr. Higgs was once married, to an American Linguistics lecturer named
Jody but, after he became somewhat famous, she divorced him, feeling
that he was excessively absorbed in his career.
My contribution to this story is the thought that she didn't want to
become known as the HIGGS BOSON'S MATE.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Decision --> Criteria

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

An optician is a specialized health care practitioner who designs, fits and dispenses lenses for the correction of a person's vision. I wouldn't call an optician an expert in eyes. I'd get a second opinion from an ophthalmologist.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Preferably bug free.

I like my code consistently indented with relevant comments and enough white space to improve readability. Ifindthatnowhitespaceishardtoread but too much white space is annoying and unnecessary.

I find a good process is to first write my modules in pseudocode, then I can turn that pseudocode into comments when I add the actual code.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

And why is it called the “God particle”?

Like God, it is everywhere but hard to find, goes the quip. In fact, the origin of the name is rather less poetic. It comes from the title of a book by Nobel physicist Leon Lederman whose draft title was “The Goddamn Particle,” to describe the frustrations of trying to nail the Higgs. The title was cut back to The God Particle by his publisher, apparently fearful that “Goddamn” could be offensive.

Full article here

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The character of Matlock was partly based on James Stewart's character in Anatomy of a Murder. I grew up on the Andy Griffith Show. The last thing I recall seeing him in was a 2007 movie, The Waitress.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Not computer trivia but still interesting trivia - can anyone tell me why The Enterprise registration number is "1701"?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

My degree was in Computer Science. I don't know what topics get covered in Information Technology these days but I was amazed at how much the curriculum had changed from when I got my degree in 1977 and when my younger son graduated from the same University in 2009. There was a lot more emphasis on programming and numerical analysis back in the 70s.

The earlier advice (learn more programming languages) is sound. If you know only one language your mind gets stuck in one mode of thinking. It's the old "if the only tool you have is a hammer you tend to see every problem as a nail" scenario. You are better off learning a few languages reasonably well than many poorly.

I've found that a good way to learn is by answering questions on this forum. If I see an interesting question that I don't know the answer to I do a little research and a little experimenting.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you can't find what you are looking for you might try VirtualDub. You might be able to cobble something together with that and AutoIt. AutoIt can be scripted using either its own scripting interface, or instantiated in vbScript/VB/etc. and controlled via AutoItX methods & properties.

Caveat - if you are picking random places as a starting point for extracting clips, remember to moveto either the previous or next keyframe. If you pick a point between two keyframes, the first bit of video will be garbled.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You can modify the individual cells in a datagridview via the Style property as follows:

DataGridView1.Rows(1).Cells(1).Style.BackColor = Color.Aqua
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Actually, I think it's more likely they will run on water.

I have a boat that runs on water.

Our electricity here in Manitoba is relatively cheap, mostly hydroelectric and produced by a well managed public utility (thanks again Bob) with excellent staff (right Stuugie?). Unfortunately, electric/hybrid cars are so expensive that most people cannot justify the added cost up front.

And don't get me started on this BS about how when crude oil prices go down "it takes about three months for the cheaper oil to work through the system and result in lower prices at the pump" but an increase in crude is reflected at the pump the next day. According to the oil companies' reasoning and the current price of crude we should be paying around 95 cents a litre but we are actually paying around $1.25.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'm not sure I see the problem. If the results are displayed in form2 then they will be shown when the form has finished rendering. If you want to post the zipped project I can try running it locally.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

When you can remember getting into trouble for typewriter hacking as a teenager.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

This cartoon really captures up how I feel about a lot of software examples.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

A scientist working outside San Diego is researching aging and how to delay it. He has decided that with the proper diet, aging can be suspended. In order to test this hypothesis he has tried various diets on porpoises and discovered that they show little or no signs of aging when fed a diet consisting mainly of ground up seagull meat.

One day after his weekly trip to the seashore to look for dead seagulls, he returns to his lab carrying his bag of birds only to find that a lion has escaped from the San Diego Zoo and fallen asleep on his doorstep. Not wanting to wake the fierce creature, he tucks the bag under one arm and carefully steps over the lion. Once inside he phones animal control to retrieve the lion. Instead, the police come and arrest him - for transporting gulls across a staid lion for immortal porpoises.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Surf and turf (sort of). I just took a salmon and some marinated beef strips out of my smoker and we are going to have that with a vegetable stir fry and rice.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'm not that familiar with C# but try replacing

Source=C:\Users\dell\Desktop\Database\Student_Access.mdb

with

Source=C:\\Users\\dell\\Desktop\\Database\\Student_Access.mdb
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It's not trivial. If you have no idea how to do it I suggest you use the existing tools.

ISOWriter utility is designed as a command-line-based alternative to the GUI-based ISO Recorder. It has has been designed to allow for unattended operations from batch files. A non-zero exit code is retuarned on failure

Download

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You can always add Encryption/Decrption to just the Password field if you like.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Try this

Public Class Form1

    Const INIFILE = "d:\utils\temp\test.ini"

    Structure Account
        Dim AcctName As String
        Dim Version As String
        Dim Login As String
        Dim Username As String
        Dim Password As String
        Dim Character As String
        Dim Server As String
        Dim ReturnLogin As String
        Dim LoginStart As String
        Dim RelogDisco As String
        Dim DisMap As String
        Dim SpecialAcc As String
    End Structure

    Private Accounts() As Account

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub btnRead_Click(sender As System.Object, e As System.EventArgs) Handles btnRead.Click

        Dim accts() As String = INIRead(INIFILE).Split(Chr(0))
        ReDim Accounts(UBound(accts) - 1)

        For i As Integer = 0 To UBound(accts) - 1
            Accounts(i).AcctName = accts(i)
            Accounts(i).Version = INIRead(INIFILE, accts(i), "Version")
            Accounts(i).Login = INIRead(INIFILE, accts(i), "Login")
            Accounts(i).Username = INIRead(INIFILE, accts(i), "Username")
            Accounts(i).Password = INIRead(INIFILE, accts(i), "Password")
            Accounts(i).Character = INIRead(INIFILE, accts(i), "Character")
            Accounts(i).Server = INIRead(INIFILE, accts(i), "Server")
            Accounts(i).ReturnLogin = INIRead(INIFILE, accts(i), "ReturnLogin")
            Accounts(i).LoginStart = INIRead(INIFILE, accts(i), "LoginStart")
            Accounts(i).RelogDisco = INIRead(INIFILE, accts(i), "RelogDisco")
            Accounts(i).DisMap = INIRead(INIFILE, accts(i), "DisMap")
            Accounts(i).SpecialAcc = INIRead(INIFILE, accts(i), "SpecialAcc")
        Next

    End Sub

    Private Sub btnWrite_Click(sender As System.Object, e As System.EventArgs) Handles btnWrite.Click

        For Each acct As Account In Accounts
            INIWrite(INIFILE, acct.AcctName, "Version", acct.Version)
            INIWrite(INIFILE, acct.AcctName, "Login", acct.Login)
            INIWrite(INIFILE, acct.AcctName, "Username", acct.Username)
            INIWrite(INIFILE, acct.AcctName, "Password", acct.Password)
            INIWrite(INIFILE, acct.AcctName, "Character", acct.Character)
            INIWrite(INIFILE, acct.AcctName, "Server", acct.Server)
            INIWrite(INIFILE, acct.AcctName, "ReturnLogin", acct.ReturnLogin)
            INIWrite(INIFILE, acct.AcctName, "LoginStart", acct.LoginStart)
            INIWrite(INIFILE, acct.AcctName, "RelogDisco", acct.RelogDisco)
            INIWrite(INIFILE, acct.AcctName, "DisMap", acct.DisMap)
            INIWrite(INIFILE, acct.AcctName, "SpecialAcc", acct.SpecialAcc)
        Next

    End Sub

End Class
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In the case where you have parallel sections like [Account 0], [Account 1], etc and each section has the same settings, you could modify the inifile class with a new method to return the parallel items as arrays. It would look something like

    Public Function GetAllValues(sectionStarts As String, setting As String) As String()

        'create an array of all settings with the given setting name in sections
        'that start with the given string

        Dim settings As String = ""

        For Each section As String In m_inifile.Keys
            If section.StartsWith(sectionStarts) Then
                If m_inifile(section).ContainsKey(setting) Then
                    settings = settings & vbLf & m_inifile(section)(setting)
                End If
            End If
        Next

        Return settings.Substring(1).Split(vbLf)

    End Function

Note that with this code you would get the info as in

Dim versions() As String = ini.GetAllValues("[Account","Version)

Which returns an array of all version settings in sections which start with "[Account"

The return statement might look a little odd. It strips off the first vbLf before splitting to avoid returning an ampty element (you have to have one fewer delimiters than you have elements).

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I click and drag. I see that double clicking does it correctly. I'll do that from now on. Thanks.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Use "&" instead of "+" when concatenating your string and numeric values. Also, inside your Class, you should declare properties as Public or Private instead of using Dim. And declare Subs and Functions as Public or Private as well.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

When I copy vb code from a post to try locally, pasting the code always results in the removal of blank lines. It doesn't matter if I paste into Visual Studio or TextPad. Blank lines are never maintained. If I paste into VB, indentation is recreated based on the code structure, however, pasting into TextPad results in all code being left aligned and indented by four spaces no matter what the code structure or the indentation on the originally posted code.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It was a dark and stormy night. OK. Not so stormy but it did rain and I was awake so I expanded on my earlier post. I'm going to post this code in three sections.

Part one is a rudimentary inifile Class. This class contains methods for reading/writing/maintaining an ini file. It could use some bulletproofing and such (see comments) but should be a good starting place for anyone who wants to tailor it to specific needs. Sections are identified by

[section]
setting=value
setting=value
.
.
.

blank lines and comments are not allowed. This is left as an excercise for the student (I hated that phrase when I was a student).

Imports System.IO

Public Class inifile

    '------------------------------------------------
    '  Name:
    '
    '    inifile.vb
    '
    '  Description:
    '
    '    Simple minded implementation of an inifile reader/writer class. The functionality is all
    '    here except that error checking is minimal, everythinig is case sensitive and there is
    '    no provision to maintain blank lines or comments.
    '
    '  Properties:
    '
    '    status - String - blank or a string indicating the nature of the error
    '
    '  Methods:
    '
    '    Read(filename)
    '
    '        Read the given inifile into memory
    '
    '    Write()
    '
    '        Write the in-memory inifile to the last read inifile on disk
    '
    '    Write(filename)
    '
    '        Write the in0memory inifile to the given file and make it the current file
    '
    '    GetValue(section,setting)
    '
    '        Return the value of the given setting …