473,320 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 1059
>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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Rich | last post by:
Hello, I picked up this example on using the Reflection namespace for loading forms/classes on the fly at msdn http://msdn.microsoft.com/library/default.asp?...
5
by: Dean Slindee | last post by:
I store several application settings in the project's "app.config" file. I also have a form that reads these values and displays them in a listview so that the user can adjust them. My question...
11
by: TARUN | last post by:
Hello All I need to ask about the configuration file in .NET, There are Two config File 1. Web Config 2. Machine config I understand the the usage of Web config , but not able to understand...
5
by: Keith | last post by:
Hello all, I have a C# Windows Forms app. It is in namespace App.GUI. It builds to Nav.exe. I have entered an application level setting using the designer. Its type is string, name is "FOO"...
5
by: mark_overstreet | last post by:
I have a generic data layer DLL that expects to read its connection string from it's own config file. The dll and config file have been placed in the bin directory (VS.NET2005). However, due to...
1
by: =?Utf-8?B?Y2FsZGVyYXJh?= | last post by:
Dear all, I am developing a multi tiers application and actually responsible of delivering the buines logic library. That buisnes logic library will need some parameters to be suitebale...
12
by: dbuchanan | last post by:
Hello, (Is this the proper newsgroup?) === Background === I am building a solution with two projects. One project is my data access layer which contains my DataSet as an xsd file. The XSD...
14
by: Naraendirakumar R.R. | last post by:
I have a client in the healthcare industry who would prefer to store the connection string in a centralized location in their Active Directory repository. Has anybody done this? What has your...
1
by: samadams_2006 | last post by:
Hello, I haven't done much programming in .asp and was wondering if someone could provide me with some sample code to do the following task... I have a Web Service called: ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.