473,486 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Loop problem at runtime

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
34 1251
"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
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
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
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
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
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
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
* 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
* "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
* "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
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
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
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
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

"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
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
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
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
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
* "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
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
> * "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
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
"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
* "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
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
"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
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
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
* 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
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
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
* "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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

47
12015
by: Mountain Bikn' Guy | last post by:
Take some standard code such as shown below. It simply loops to add up a series of terms and it produces the correct result. // sum numbers with a loop public int DoSumLooping(int iterations) {...
34
2643
by: Frederick Gotham | last post by:
Is the domestic usage of the C "for" loop inefficient when it comes to simple incrementation? Here's a very simple program that prints out the bit-numbers in a byte. #include <stdio.h> #include...
10
1835
by: Derek Hart | last post by:
I am going in circles trying to loop through properties on 3rd party controls. For example, I have a textbox that has its maximum length located at MyTextBox.Properties.MaxLength - instead of the...
0
7100
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6842
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3070
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.