471,073 Members | 1,304 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,073 software developers and data experts.

easy app.config question

Hello All!

This seems pretty easy, but I'm missing something. In my app config file I
have
<add key="HL7File.Path" value="C:\Planes\STB" />

Then in my code I have below Windows Generated Code
Protected HL7File As String =
ConfigurationSettings.AppSettings("HL7File.Path")

Then when I need to call it.

Private Sub btn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn.Click
Dim TimeStamp As String = Guid.NewGuid.GetHashCode
Dim TempFile As String = "HL7File.Path"
Dim ext As String = ".out"
Dim FileName As String = TempFile & TimeStamp & ext
Dim fs As New FileStream(FileName, FileMode.Create)
fs.Close()
File.Delete(FileName)
End Sub

I thought this would be pretty simple, what am I dong wrong? How can I call
that value back so I can use it?

TIA!

Rudy

Feb 6 '07 #1
2 1006
>This seems pretty easy, but I'm missing something. In my app config file I
>have
<add key="HL7File.Path" value="C:\Planes\STB" />

Then in my code I have below Windows Generated Code
Protected HL7File As String =
ConfigurationSettings.AppSettings("HL7File.Path ")

Then when I need to call it.

Private Sub btn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn.Click
Dim TimeStamp As String = Guid.NewGuid.GetHashCode
Dim TempFile As String = "HL7File.Path"
Dim ext As String = ".out"
Dim FileName As String = TempFile & TimeStamp & ext
Dim fs As New FileStream(FileName, FileMode.Create)
fs.Close()
File.Delete(FileName)
End Sub

I thought this would be pretty simple, what am I dong wrong? How can I call
that value back so I can use it?
Well, you first read the value into your "HL7File" string, but then
you don't use that? Odd... :-)

Private Sub btn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn.Click
Dim TimeStamp As String = Guid.NewGuid.GetHashCode

// no need for that -
// you've already read the value into "HL7File" !
-- Dim TempFile As String = "HL7File.Path"

Dim ext As String = ".out"

// use that "HL7File" variable you've set up !
Dim FileName As String = HL7File & TimeStamp & ext
Dim fs As New FileStream(FileName, FileMode.Create)
fs.Close()
File.Delete(FileName)
End Sub
HTH
Marc
Feb 6 '07 #2
Thanks Marc!

"Marc Scheuner" wrote:
This seems pretty easy, but I'm missing something. In my app config file I
have
<add key="HL7File.Path" value="C:\Planes\STB" />

Then in my code I have below Windows Generated Code
Protected HL7File As String =
ConfigurationSettings.AppSettings("HL7File.Path")

Then when I need to call it.

Private Sub btn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn.Click
Dim TimeStamp As String = Guid.NewGuid.GetHashCode
Dim TempFile As String = "HL7File.Path"
Dim ext As String = ".out"
Dim FileName As String = TempFile & TimeStamp & ext
Dim fs As New FileStream(FileName, FileMode.Create)
fs.Close()
File.Delete(FileName)
End Sub

I thought this would be pretty simple, what am I dong wrong? How can I call
that value back so I can use it?

Well, you first read the value into your "HL7File" string, but then
you don't use that? Odd... :-)

Private Sub btn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn.Click
Dim TimeStamp As String = Guid.NewGuid.GetHashCode

// no need for that -
// you've already read the value into "HL7File" !
-- Dim TempFile As String = "HL7File.Path"

Dim ext As String = ".out"

// use that "HL7File" variable you've set up !
Dim FileName As String = HL7File & TimeStamp & ext
Dim fs As New FileStream(FileName, FileMode.Create)
fs.Close()
File.Delete(FileName)
End Sub
HTH
Marc
Feb 6 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Dean Slindee | last post: by
11 posts views Thread by TARUN | last post: by
5 posts views Thread by mark_overstreet | last post: by
1 post views Thread by =?Utf-8?B?Y2FsZGVyYXJh?= | last post: by
reply views Thread by leo001 | last post: by

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.