🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.pl.comp.lang.csharp
Article #546

Czy ktoś tu jeszcze zagląda?

#546
From: Tomasz
Date: Mon, 08 Mar 2004 19:47
52 lines
2329 bytes
Witam
Mam pytanie
zerżnołem kawałek kodu :]
odczytanie wartości klucza rejestru.
Kilka linijek niby proste ale za cholere nie wiem skąd błąd:
"System.NullReferenceException: Object reference not set to an instance 
of an object."

wrrr

następuje to napewno w momencie wyciągania wartości z rkRegkey

ściągnołem przykład i nie działa, źródła z błędem co jest do cholewy 
wójka antosia..???

pozdro
kosmen

ps.
na podstawie
http://www.codeproject.com/cs/database/AbdMySqlSchema.asp

RegistryKey rkRegkey;
ArrayList   alDSNList;
			
alDSNList = new ArrayList();			
// first get system DSN
rkRegkey = 
Registry.LocalMachine.OpenSubKey(@"Software\ODBC\ODBC.INI\ODBC Data 
Sources");				
foreach(string strValueNames in rkRegkey.GetValueNames())
{
	alDSNList.Add(strValueNames);
} 			
// second get user's DSN
rkRegkey = Registry.CurrentUser.OpenSubKey(@"Software\ODBC\ODBC.INI\ODBC 
Data Sources");
			
foreach(string strValueNames in rkRegkey.GetValueNames())
{
	alDSNList.Add(strValueNames);
} 	
// convert the linked list to array
object[] objDSNArray = alDSNList.ToArray();
//dfForm.txtDSN        = this.txtDSN;

// create the instance of the window that will display the DSN
// and the listbox			
for (int i = 0; i < objDSNArray.Length; i++)
{	
	lstDSN.Items.Insert(i, objDSNArray[i]);
}		
Technical Details
Message-ID: <c2iil5$bpr$1@atlantis.news.tpi.pl>
Path: mbox-mo1.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!proxad.net!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!proxad.net!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail
From: Tomasz <kosm...@wp.pl>
Newsgroups: alt.pl.comp.lang.csharp
Subject: Czy ktoś tu jeszcze zagląda?
Date: Mon, 08 Mar 2004 20:47:25 +0100
Organization: tp.internet - http://www.tpi.pl/
Lines: 52
Message-ID: <c2iil5$bpr$1@atlantis.news.tpi.pl>
NNTP-Posting-Host: abb116.neoplus.adsl.tpnet.pl
Mime-Version: 1.0
X-Trace: atlantis.news.tpi.pl 1078775270 12091 83.27.11.116 (8 Mar 2004 19:47:50 GMT)
X-Complaints-To: use...@tpi.pl
NNTP-Posting-Date: Mon, 8 Mar 2004 19:47:50 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; PL; rv:1.6b) Gecko/20031205 Thunderbird/0.4
X-Accept-Language: pl, en-us, en
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit