Click here to Skip to main content
16,005,125 members
Home / Discussions / C#
   

C#

 
GeneralRe: Coloring issue Pin
Muammar©12-Nov-07 0:16
Muammar©12-Nov-07 0:16 
AnswerRe: Coloring issue [modified] Pin
Bekjong12-Nov-07 0:22
Bekjong12-Nov-07 0:22 
GeneralRe: Coloring issue Pin
Muammar©12-Nov-07 19:05
Muammar©12-Nov-07 19:05 
Questionhow to get focus on textbox control in C#.NEt Pin
D i x y11-Nov-07 22:48
D i x y11-Nov-07 22:48 
AnswerRe: how to get focus on textbox control in C#.NEt Pin
Christian Graus11-Nov-07 22:54
protectorChristian Graus11-Nov-07 22:54 
AnswerRe: how to get focus on textbox control in C#.NEt Pin
Muammar©11-Nov-07 23:06
Muammar©11-Nov-07 23:06 
AnswerRe: how to get focus on textbox control in C#.NEt Pin
Sunil Wise11-Nov-07 23:22
professionalSunil Wise11-Nov-07 23:22 
QuestionUsing ConfigurationManager.AppSettings as a constant Pin
thestonefox11-Nov-07 22:39
thestonefox11-Nov-07 22:39 
Hi all

I require to store a location path in my web.config file and then use this path in my application by using

mypath = ConfigurationManager.AppSettings["mypath"]

however, this path is being used to load in a dll, like so

[DllImport(mypath+"mydll.dll", EntryPoint="runme", ExactSpelling=true, SetLastError=false, CallingConvention = CallingConvention.Cdecl)]

and because the DllImport is in the head of the class (before any methods) I require to create the path as a constant string, like so

const string mypath= "C:\\mypath\\"

now this works if I don't use the ConfigurationManager to get my path from the web.config and I hard code the path into the class. However, I dont want the path hard coded in.

If I do this though

const string mypath=ConfigurationManager.AppSettings["mypath"]

It complains and says:

Error 7 'myclass.mypath' is of type 'string.' A const of reference type other than string can only be initialized with null

I'm confused by this because I thought ConfigurationManager.AppSettings["mypath"] returned a String, so why cant I just use that?

Does anyone know how to do this?




AnswerRe: Using ConfigurationManager.AppSettings as a constant Pin
sedatkurt11-Nov-07 22:49
sedatkurt11-Nov-07 22:49 
GeneralRe: Using ConfigurationManager.AppSettings as a constant Pin
thestonefox11-Nov-07 22:55
thestonefox11-Nov-07 22:55 
GeneralRe: Using ConfigurationManager.AppSettings as a constant Pin
sedatkurt11-Nov-07 23:05
sedatkurt11-Nov-07 23:05 
AnswerRe: Using ConfigurationManager.AppSettings as a constant Pin
Justin Perez11-Nov-07 22:52
Justin Perez11-Nov-07 22:52 
GeneralRe: Using ConfigurationManager.AppSettings as a constant Pin
thestonefox11-Nov-07 22:55
thestonefox11-Nov-07 22:55 
AnswerRe: Using ConfigurationManager.AppSettings as a constant Pin
DavidNohejl11-Nov-07 23:07
DavidNohejl11-Nov-07 23:07 
AnswerRe: Using ConfigurationManager.AppSettings as a constant Pin
Rajasekharan Vengalil11-Nov-07 23:20
Rajasekharan Vengalil11-Nov-07 23:20 
Questionfileinfo class [modified] Pin
Sunil Wise11-Nov-07 22:33
professionalSunil Wise11-Nov-07 22:33 
AnswerRe: Is License Required Pin
Michael Sync11-Nov-07 22:33
Michael Sync11-Nov-07 22:33 
GeneralRe: Is License Required Pin
Michael Sync11-Nov-07 22:43
Michael Sync11-Nov-07 22:43 
QuestionCombobox Selected Value Pin
M. J. Jaya Chitra11-Nov-07 21:56
M. J. Jaya Chitra11-Nov-07 21:56 
AnswerRe: Combobox Selected Value Pin
Michael Sync11-Nov-07 22:12
Michael Sync11-Nov-07 22:12 
GeneralRe: Combobox Selected Value Pin
M. J. Jaya Chitra11-Nov-07 22:42
M. J. Jaya Chitra11-Nov-07 22:42 
GeneralRe: Combobox Selected Value Pin
Michael Sync12-Nov-07 0:52
Michael Sync12-Nov-07 0:52 
Questionhow to add webreferences dynamically in C#.net Pin
christefer11-Nov-07 21:36
christefer11-Nov-07 21:36 
AnswerRe: how to add webreferences dynamically in C#.net [modified] Pin
Pankaj - Joshi11-Nov-07 21:45
Pankaj - Joshi11-Nov-07 21:45 
QuestionShowing Images Pin
kingletas11-Nov-07 20:32
kingletas11-Nov-07 20:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.