By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,479 Members | 988 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,479 IT Pros & Developers. It's quick & easy.

Loop problem at runtime

P: n/a
Here is my code:

Dim sr1 As StreamReader = New StreamReader(Application.StartupPath &
"\Controls.ini")

strGameExists = "no"

intCheck = 0

Do

strLine = sr1.ReadLine()

intCheck = InStr(strLine, "[" & strParentName & "]")

If intCheck > 0 Then

strGameExists = "yes"

End If

Loop Until intCheck > 0 Or strLine Is Nothing

sr1.Close()

If strGameExists = "yes" Then

do something

else

do something else

End if
The code works great in the debugger. It finds the string, sets
strGameExists to "yes" and executes my code. However, at runtime it always
executes my do something else code. Am I missing something here?

Thank you,
John


Nov 20 '05 #1
Share this Question
Share on Google+
34 Replies


P: n/a
"jcrouse" <me> wrote in news:uV**************@TK2MSFTNGP11.phx.gbl:
Dim sr1 As StreamReader = New StreamReader(Application.StartupPath &
"\Controls.ini")


BTW, out of curiousity... any reason why you're using a .ini file instead
of an app.config file?

An app.config is in XML so it's much easier to read from.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 20 '05 #2

P: n/a
That doesent answer the OP's questions Lucas.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn**************************@140.99.99.130...
"jcrouse" <me> wrote in news:uV**************@TK2MSFTNGP11.phx.gbl:
Dim sr1 As StreamReader = New StreamReader(Application.StartupPath &
"\Controls.ini")


BTW, out of curiousity... any reason why you're using a .ini file instead
of an app.config file?

An app.config is in XML so it's much easier to read from.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 20 '05 #3

P: n/a
If strGameExists = "yes" Then '<<<<<<< Debug value here for strGameExists
is ?????

do something

else

do something else

End if
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"jcrouse" <me> wrote in message
news:uV**************@TK2MSFTNGP11.phx.gbl...
Here is my code:

Dim sr1 As StreamReader = New StreamReader(Application.StartupPath &
"\Controls.ini")

strGameExists = "no"

intCheck = 0

Do

strLine = sr1.ReadLine()

intCheck = InStr(strLine, "[" & strParentName & "]")

If intCheck > 0 Then

strGameExists = "yes"

End If

Loop Until intCheck > 0 Or strLine Is Nothing

sr1.Close()

If strGameExists = "yes" Then

do something

else

do something else

End if
The code works great in the debugger. It finds the string, sets
strGameExists to "yes" and executes my code. However, at runtime it always
executes my do something else code. Am I missing something here?

Thank you,
John

Nov 20 '05 #4

P: n/a
Terry,
That doesent answer the OP's questions Lucas.


However in my opinion not forbidden to ask, this is a newsgroup meant to
learn from each other. Everybody can has a reason why he use an INI file
instead of an XML file so how more reasons you know how better it is to make
own decisions in that.

Just my thought about a newsgroup.

Cor
Nov 20 '05 #5

P: n/a
Sure, I was just pointing out that some help along with the question would
have been nice !

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:e%****************@TK2MSFTNGP10.phx.gbl...
Terry,
That doesent answer the OP's questions Lucas.
However in my opinion not forbidden to ask, this is a newsgroup meant to
learn from each other. Everybody can has a reason why he use an INI file
instead of an XML file so how more reasons you know how better it is to

make own decisions in that.

Just my thought about a newsgroup.

Cor

Nov 20 '05 #6

P: n/a
Actually, a better reply would have been ( And this includes mine ) along
the lines.

1.) Here is how to look at your problem/slove it.

2.) Did you know, there are several other ways to store information about
x,y,z, here they are. . .
Some text
Link

Some text
Link

Some text
Link

If you need more help, please post back to the NG
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:e%****************@TK2MSFTNGP10.phx.gbl...
Terry,
That doesent answer the OP's questions Lucas.
However in my opinion not forbidden to ask, this is a newsgroup meant to
learn from each other. Everybody can has a reason why he use an INI file
instead of an XML file so how more reasons you know how better it is to

make own decisions in that.

Just my thought about a newsgroup.

Cor

Nov 20 '05 #7

P: n/a
Terry
1.) Here is how to look at your problem/slove it.

2.) Did you know, there are several other ways to store information about
x,y,z, here they are. . .

As we try to do it, however when someone has no solution however is curious
why?

Maybe he is curious for himself because everybody has told that an XML file
is better and now there is somebody who stays with the INI file so he wants
to know why, just for is own purpose.

However basicly we agree, (in what I had no doubt)

Cor
Nov 20 '05 #8

P: n/a
* Lucas Tam <RE********@rogers.com> scripsit:
Dim sr1 As StreamReader = New StreamReader(Application.StartupPath &
"\Controls.ini")


BTW, out of curiousity... any reason why you're using a .ini file instead
of an app.config file?

An app.config is in XML so it's much easier to read from.


I doubt that it's easier to read. It's much more complicated to parse.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #9

P: n/a
* "One Handed Man \( OHM - Terry Burns \)" <news.microsoft.com> scripsit:
Actually, a better reply would have been ( And this includes mine ) along
the lines.


It simply doesn't matter. Every post that adds something to the
discussion is valuable, irrespective of its completeness.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #10

P: n/a
* "jcrouse" <me> scripsit:
Dim sr1 As StreamReader = New StreamReader(Application.StartupPath &
"\Controls.ini")
Use 'System.OP.Path.Combine' to combine path and file name.
strGameExists = "no"

intCheck = 0

Do

strLine = sr1.ReadLine()

intCheck = InStr(strLine, "[" & strParentName & "]")

If intCheck > 0 Then

strGameExists = "yes"

End If

Loop Until intCheck > 0 Or strLine Is Nothing


Use 'OrElse' instead of 'Or'.

Are you sure the same file is read when running in IDE and when running
the executable file? Add a breakpoint to the line that assigns the read
string to 'strLine' and check its value there. To add a breakpoint,
clock the bar on the right side of the text-editor until a darkred
bullet appears:

| | For i = 1 To 10
|o| Foo = True
| | Next i

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #11

P: n/a
While in VB, the debug value there for strGameExists is "yes" and it
executes the proper code in the decision logic. However, after compiling it
won't go into the "yes" part of the loop, only the Else, (no) branch.

Thanks,
John

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:u$**************@TK2MSFTNGP09.phx.gbl...
If strGameExists = "yes" Then '<<<<<<< Debug value here for strGameExists
is ?????

do something

else

do something else

End if
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"jcrouse" <me> wrote in message
news:uV**************@TK2MSFTNGP11.phx.gbl...
Here is my code:

Dim sr1 As StreamReader = New StreamReader(Application.StartupPath &
"\Controls.ini")

strGameExists = "no"

intCheck = 0

Do

strLine = sr1.ReadLine()

intCheck = InStr(strLine, "[" & strParentName & "]")

If intCheck > 0 Then

strGameExists = "yes"

End If

Loop Until intCheck > 0 Or strLine Is Nothing

sr1.Close()

If strGameExists = "yes" Then

do something

else

do something else

End if
The code works great in the debugger. It finds the string, sets
strGameExists to "yes" and executes my code. However, at runtime it always executes my do something else code. Am I missing something here?

Thank you,
John


Nov 20 '05 #12

P: n/a
As a matter of fact ,reading XML is quite simple, I use it all the time.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eq*************@TK2MSFTNGP10.phx.gbl...
* Lucas Tam <RE********@rogers.com> scripsit:
Dim sr1 As StreamReader = New StreamReader(Application.StartupPath &
"\Controls.ini")


BTW, out of curiousity... any reason why you're using a .ini file instead of an app.config file?

An app.config is in XML so it's much easier to read from.


I doubt that it's easier to read. It's much more complicated to parse.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 20 '05 #13

P: n/a
OK, well you can use trace.writeline(your text) to tell you whats happening
during execution on realease code. In the realease code, is the ini file in
the executable directory ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"jcrouse" <me> wrote in message
news:u%****************@TK2MSFTNGP10.phx.gbl...
While in VB, the debug value there for strGameExists is "yes" and it
executes the proper code in the decision logic. However, after compiling it won't go into the "yes" part of the loop, only the Else, (no) branch.

Thanks,
John

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message news:u$**************@TK2MSFTNGP09.phx.gbl...
If strGameExists = "yes" Then '<<<<<<< Debug value here for strGameExists
is ?????

do something

else

do something else

End if
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"jcrouse" <me> wrote in message
news:uV**************@TK2MSFTNGP11.phx.gbl...
Here is my code:

Dim sr1 As StreamReader = New StreamReader(Application.StartupPath &
"\Controls.ini")

strGameExists = "no"

intCheck = 0

Do

strLine = sr1.ReadLine()

intCheck = InStr(strLine, "[" & strParentName & "]")

If intCheck > 0 Then

strGameExists = "yes"

End If

Loop Until intCheck > 0 Or strLine Is Nothing

sr1.Close()

If strGameExists = "yes" Then

do something

else

do something else

End if
The code works great in the debugger. It finds the string, sets
strGameExists to "yes" and executes my code. However, at runtime it

always executes my do something else code. Am I missing something here?

Thank you,
John



Nov 20 '05 #14

P: n/a
Yes, it is.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:O2**************@TK2MSFTNGP10.phx.gbl...
OK, well you can use trace.writeline(your text) to tell you whats happening during execution on realease code. In the realease code, is the ini file in the executable directory ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"jcrouse" <me> wrote in message
news:u%****************@TK2MSFTNGP10.phx.gbl...
While in VB, the debug value there for strGameExists is "yes" and it
executes the proper code in the decision logic. However, after compiling

it
won't go into the "yes" part of the loop, only the Else, (no) branch.

Thanks,
John

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message
news:u$**************@TK2MSFTNGP09.phx.gbl...
If strGameExists = "yes" Then '<<<<<<< Debug value here for strGameExists is ?????

do something

else

do something else

End if
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"jcrouse" <me> wrote in message
news:uV**************@TK2MSFTNGP11.phx.gbl...
> Here is my code:
>
> Dim sr1 As StreamReader = New StreamReader(Application.StartupPath &
> "\Controls.ini")
>
> strGameExists = "no"
>
> intCheck = 0
>
> Do
>
> strLine = sr1.ReadLine()
>
> intCheck = InStr(strLine, "[" & strParentName & "]")
>
> If intCheck > 0 Then
>
> strGameExists = "yes"
>
> End If
>
> Loop Until intCheck > 0 Or strLine Is Nothing
>
> sr1.Close()
>
> If strGameExists = "yes" Then
>
> do something
>
> else
>
> do something else
>
> End if
>
>
> The code works great in the debugger. It finds the string, sets
> strGameExists to "yes" and executes my code. However, at runtime it

always
> executes my do something else code. Am I missing something here?
>
> Thank you,
> John
>
>
>
>



Nov 20 '05 #15

P: n/a

"Herfried K. Wagner

BTW, out of curiousity... any reason why you're using a .ini file instead of an app.config file?

An app.config is in XML so it's much easier to read from.


I doubt that it's easier to read. It's much more complicated to parse.

As a matter of fact ,reading XML is quite simple, I use it all the time.

Cor
Nov 20 '05 #16

P: n/a
This is really no better or worse than your code, just the method I prefer
when looping through a text file.

HTH,
Greg

(untested)

' equivalent, take your pick...
Dim sr1 As StreamReader =
File.OpenText(System.IO.Path.Combine(Application.S tartupPath,
"Controls.ini"))
'Dim sr1 As StreamReader = New
StreamReader(System.IO.Path.Combine(Application.St artupPath,
"Controls.ini"))

Dim bGameExists As Boolean = False
Dim strLine As String
Dim strParentName As String = "somevalue"

strLine = sr1.ReadLine()

Do While Not strLine Is Nothing

Dim intCheck As Integer = 0

intCheck = InStr(strLine, "[" & strParentName & "]")

If intCheck > 0 Then

bGameExists = True
Exit Do

End If

strLine = sr1.ReadLine()

Loop

sr1.Close()

If bGameExists = True Then

'do something

Else

'do something else

End If
"jcrouse" <me> wrote in message
news:uV**************@TK2MSFTNGP11.phx.gbl...
Here is my code:

Dim sr1 As StreamReader = New StreamReader(Application.StartupPath &
"\Controls.ini")

strGameExists = "no"

intCheck = 0

Do

strLine = sr1.ReadLine()

intCheck = InStr(strLine, "[" & strParentName & "]")

If intCheck > 0 Then

strGameExists = "yes"

End If

Loop Until intCheck > 0 Or strLine Is Nothing

sr1.Close()

If strGameExists = "yes" Then

do something

else

do something else

End if
The code works great in the debugger. It finds the string, sets
strGameExists to "yes" and executes my code. However, at runtime it always
executes my do something else code. Am I missing something here?

Thank you,
John

Nov 20 '05 #17

P: n/a
That depends where you put it

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:O2**************@TK2MSFTNGP10.phx.gbl...
OK, well you can use trace.writeline(your text) to tell you whats happening during execution on realease code. In the realease code, is the ini file in the executable directory ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"jcrouse" <me> wrote in message
news:u%****************@TK2MSFTNGP10.phx.gbl...
While in VB, the debug value there for strGameExists is "yes" and it
executes the proper code in the decision logic. However, after compiling

it
won't go into the "yes" part of the loop, only the Else, (no) branch.

Thanks,
John

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message
news:u$**************@TK2MSFTNGP09.phx.gbl...
If strGameExists = "yes" Then '<<<<<<< Debug value here for strGameExists is ?????

do something

else

do something else

End if
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"jcrouse" <me> wrote in message
news:uV**************@TK2MSFTNGP11.phx.gbl...
> Here is my code:
>
> Dim sr1 As StreamReader = New StreamReader(Application.StartupPath &
> "\Controls.ini")
>
> strGameExists = "no"
>
> intCheck = 0
>
> Do
>
> strLine = sr1.ReadLine()
>
> intCheck = InStr(strLine, "[" & strParentName & "]")
>
> If intCheck > 0 Then
>
> strGameExists = "yes"
>
> End If
>
> Loop Until intCheck > 0 Or strLine Is Nothing
>
> sr1.Close()
>
> If strGameExists = "yes" Then
>
> do something
>
> else
>
> do something else
>
> End if
>
>
> The code works great in the debugger. It finds the string, sets
> strGameExists to "yes" and executes my code. However, at runtime it

always
> executes my do something else code. Am I missing something here?
>
> Thank you,
> John
>
>
>
>



Nov 20 '05 #18

P: n/a
DUP

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:e7**************@TK2MSFTNGP10.phx.gbl...

"Herfried K. Wagner

BTW, out of curiousity... any reason why you're using a .ini file instead of an app.config file?

An app.config is in XML so it's much easier to read from.


I doubt that it's easier to read. It's much more complicated to parse.

As a matter of fact ,reading XML is quite simple, I use it all the time.

Cor

Nov 20 '05 #19

P: n/a
Thanks for the code Greg. I implemented it. As far as my problem goes I
figured it out and it's a little embarrassing but maybe someone else can
learn, CHECK YOUR CASE SENSATIVITY!.

Duh,
John

"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:uR**************@TK2MSFTNGP12.phx.gbl...
This is really no better or worse than your code, just the method I prefer
when looping through a text file.

HTH,
Greg

(untested)

' equivalent, take your pick...
Dim sr1 As StreamReader =
File.OpenText(System.IO.Path.Combine(Application.S tartupPath,
"Controls.ini"))
'Dim sr1 As StreamReader = New
StreamReader(System.IO.Path.Combine(Application.St artupPath,
"Controls.ini"))

Dim bGameExists As Boolean = False
Dim strLine As String
Dim strParentName As String = "somevalue"

strLine = sr1.ReadLine()

Do While Not strLine Is Nothing

Dim intCheck As Integer = 0

intCheck = InStr(strLine, "[" & strParentName & "]")

If intCheck > 0 Then

bGameExists = True
Exit Do

End If

strLine = sr1.ReadLine()

Loop

sr1.Close()

If bGameExists = True Then

'do something

Else

'do something else

End If
"jcrouse" <me> wrote in message
news:uV**************@TK2MSFTNGP11.phx.gbl...
Here is my code:

Dim sr1 As StreamReader = New StreamReader(Application.StartupPath &
"\Controls.ini")

strGameExists = "no"

intCheck = 0

Do

strLine = sr1.ReadLine()

intCheck = InStr(strLine, "[" & strParentName & "]")

If intCheck > 0 Then

strGameExists = "yes"

End If

Loop Until intCheck > 0 Or strLine Is Nothing

sr1.Close()

If strGameExists = "yes" Then

do something

else

do something else

End if
The code works great in the debugger. It finds the string, sets
strGameExists to "yes" and executes my code. However, at runtime it always executes my do something else code. Am I missing something here?

Thank you,
John


Nov 20 '05 #20

P: n/a
* "Cor Ligthert" <no**********@planet.nl> scripsit:
of an app.config file?

An app.config is in XML so it's much easier to read from.


I doubt that it's easier to read. It's much more complicated to parse.

As a matter of fact ,reading XML is quite simple, I use it all the time.


Sure, but what's going on behind the scenes is more compilcated.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #21

P: n/a
It doesent really matter, the point is that reading an XML file is far more
structured and useful.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ej**************@tk2msftngp13.phx.gbl...
* "Cor Ligthert" <no**********@planet.nl> scripsit:
of an app.config file?

An app.config is in XML so it's much easier to read from.

I doubt that it's easier to read. It's much more complicated to parse.

As a matter of fact ,reading XML is quite simple, I use it all the time.


Sure, but what's going on behind the scenes is more compilcated.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 20 '05 #22

P: n/a
> * "Cor Ligthert" <no**********@planet.nl> scripsit:
of an app.config file?

An app.config is in XML so it's much easier to read from.

I doubt that it's easier to read. It's much more complicated to parse.

As a matter of fact ,reading XML is quite simple, I use it all the time.


Sure, but what's going on behind the scenes is more compilcated.

Maybe you can ask Terry if you can buy that old commodore 64 from him,
although I thought that what he has, is the English equivalent, however that
should not give any problem for you anymore. I have you now for a half year
not seen you telling that your mistake was because of your bad English

:-)

Cor
Nov 20 '05 #23

P: n/a
I see , well done !

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"jcrouse" <me> wrote in message
news:OL**************@tk2msftngp13.phx.gbl...
Thanks for the code Greg. I implemented it. As far as my problem goes I
figured it out and it's a little embarrassing but maybe someone else can
learn, CHECK YOUR CASE SENSATIVITY!.

Duh,
John

"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:uR**************@TK2MSFTNGP12.phx.gbl...
This is really no better or worse than your code, just the method I prefer
when looping through a text file.

HTH,
Greg

(untested)

' equivalent, take your pick...
Dim sr1 As StreamReader =
File.OpenText(System.IO.Path.Combine(Application.S tartupPath,
"Controls.ini"))
'Dim sr1 As StreamReader = New
StreamReader(System.IO.Path.Combine(Application.St artupPath,
"Controls.ini"))

Dim bGameExists As Boolean = False
Dim strLine As String
Dim strParentName As String = "somevalue"

strLine = sr1.ReadLine()

Do While Not strLine Is Nothing

Dim intCheck As Integer = 0

intCheck = InStr(strLine, "[" & strParentName & "]")

If intCheck > 0 Then

bGameExists = True
Exit Do

End If

strLine = sr1.ReadLine()

Loop

sr1.Close()

If bGameExists = True Then

'do something

Else

'do something else

End If
"jcrouse" <me> wrote in message
news:uV**************@TK2MSFTNGP11.phx.gbl...
Here is my code:

Dim sr1 As StreamReader = New StreamReader(Application.StartupPath &
"\Controls.ini")

strGameExists = "no"

intCheck = 0

Do

strLine = sr1.ReadLine()

intCheck = InStr(strLine, "[" & strParentName & "]")

If intCheck > 0 Then

strGameExists = "yes"

End If

Loop Until intCheck > 0 Or strLine Is Nothing

sr1.Close()

If strGameExists = "yes" Then

do something

else

do something else

End if
The code works great in the debugger. It finds the string, sets
strGameExists to "yes" and executes my code. However, at runtime it

always executes my do something else code. Am I missing something here?

Thank you,
John



Nov 20 '05 #24

P: n/a
"One Handed Man \( OHM - Terry Burns \)" <news.microsoft.com> wrote in
news:ud**************@TK2MSFTNGP10.phx.gbl:
That doesent answer the OP's questions Lucas.


I know - I said out of curiousity.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 20 '05 #25

P: n/a
* "One Handed Man \( OHM - Terry Burns \)" <news.microsoft.com> scripsit:
It doesent really matter, the point is that reading an XML file is far more
structured and useful.


No!

XML is /not/ useful in all situations because it's not human-readable.
It's designed for easy processing my /machines/ and not for
edititng/reading by humans. So, INI files are far more comfortable,
they support nested data structures too, and they can be parsed easily.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #26

P: n/a
hi***************@gmx.at (Herfried K. Wagner [MVP]) wrote in
news:eq*************@TK2MSFTNGP10.phx.gbl:
An app.config is in XML so it's much easier to read from.


I doubt that it's easier to read. It's much more complicated to parse.


If it's in an app.config format, you can use the:

System.Configuration.ConfigurationSettings.AppSett ings.Item("VariableName")

Writing to the app.config is a bit tougher as it's read only... but it's
still it's pretty straight forward : )

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 20 '05 #27

P: n/a
"jcrouse" <me> wrote in news:OL**************@tk2msftngp13.phx.gbl:
CHECK YOUR CASE SENSATIVITY!.


If case sensitivity is not important in your program, Ucase/Lcase any
comparisons before hand so you'll have uniform cases.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 20 '05 #28

P: n/a
Hi Herfried,

No!

XML is /not/ useful in all situations because it's not human-readable.
It's designed for easy processing my /machines/ and not for
edititng/reading by humans. So, INI files are far more comfortable,
they support nested data structures too, and they can be parsed easily.

Because that you can read it (a computer in a humanbox) does not mean that
it is for all humans readable.

However the INI file is no W3C format while the XML format is human readable
with every browser.

And serious I have always hatted that INI format so that will never be my
favorite.

(And the first sentence just for fun)

:-)

Cor
Nov 20 '05 #29

P: n/a
Lucas,
It might be easier, and more importantly more correct, to use StrComp
instead of Ucase or Lcase to do case sensitive or case insensitive
comparisons.

In addition to StrComp and the "=" operator, there is String.Compare &
String.CompareOrdinal with overloads. String.Compare simply has more options
the StrComp otherwise its personal preference on which to use.

I would use the String.Compare for example:

Imports System.Globalization

' This is effectively what "string1.ToUpper() = string2.ToUpper()" does:
If String.Compare(string1, string2, True, CultureInfo.CurrentCulture) =
0 Then

' This will do case insensitive, culture invariant comparisons:
If String.Compare(string1, string2, True, CultureInfo.InvariantCulture)
= 0 Then
For details on comparing strings see:

http://msdn.microsoft.com/library/de...ficculture.asp

http://msdn.microsoft.com/library/de...operations.asp

http://msdn.microsoft.com/library/de...rtingrules.asp

http://msdn.microsoft.com/library/de...operations.asp

Plus any sub topics of the above...

Hope this helps
Jay


"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn***************************@140.99.99.130.. .
"jcrouse" <me> wrote in news:OL**************@tk2msftngp13.phx.gbl:
CHECK YOUR CASE SENSATIVITY!.


If case sensitivity is not important in your program, Ucase/Lcase any
comparisons before hand so you'll have uniform cases.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 20 '05 #30

P: n/a
* Lucas Tam <RE********@rogers.com> scripsit:
"jcrouse" <me> wrote in news:OL**************@tk2msftngp13.phx.gbl:
CHECK YOUR CASE SENSATIVITY!.


If case sensitivity is not important in your program, Ucase/Lcase any
comparisons before hand so you'll have uniform cases.


.... alternatively, you can use 'Strings.StrComp("Hello", "HELLO",
CompareMethod.Text)' to compare using "text" semantics, or you can
specify 'Option Compare Text' for the project or each source file.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #31

P: n/a
No, BBC model B ( not commodore 64 )


--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:O$**************@TK2MSFTNGP12.phx.gbl...
* "Cor Ligthert" <no**********@planet.nl> scripsit:
>> of an app.config file?
>>
>> An app.config is in XML so it's much easier to read from.
>
> I doubt that it's easier to read. It's much more complicated to parse.>
As a matter of fact ,reading XML is quite simple, I use it all the
time.
Sure, but what's going on behind the scenes is more compilcated.
Maybe you can ask Terry if you can buy that old commodore 64 from him,
although I thought that what he has, is the English equivalent, however

that should not give any problem for you anymore. I have you now for a half year not seen you telling that your mistake was because of your bad English

:-)

Cor

Nov 20 '05 #32

P: n/a
Yes!

XML is is usefull in most situations, it IS human readable and IS easy to
navigate, there is a whole group of classes dedicated to doing just that.


--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OP**************@TK2MSFTNGP09.phx.gbl...
* "One Handed Man \( OHM - Terry Burns \)" <news.microsoft.com> scripsit:
It doesent really matter, the point is that reading an XML file is far more structured and useful.


No!

XML is /not/ useful in all situations because it's not human-readable.
It's designed for easy processing my /machines/ and not for
edititng/reading by humans. So, INI files are far more comfortable,
they support nested data structures too, and they can be parsed easily.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 20 '05 #33

P: n/a
* "One Handed Man \( OHM - Terry Burns \)" <news.microsoft.com> scripsit:
XML is is usefull in most situations, it IS human readable and IS easy to
navigate, there is a whole group of classes dedicated to doing just that.


It seems that you have decided not to be a human any more...

;-)

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #34

P: n/a
Is that the best you can come up with ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
* "One Handed Man \( OHM - Terry Burns \)" <news.microsoft.com> scripsit:
XML is is usefull in most situations, it IS human readable and IS easy to navigate, there is a whole group of classes dedicated to doing just
that.
It seems that you have decided not to be a human any more...

;-)

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 20 '05 #35

This discussion thread is closed

Replies have been disabled for this discussion.