Thread View: alt.pl.comp.lang.csharp
3 messages
3 total messages
Started by Tomasz
Mon, 08 Mar 2004 19:47
Czy ktoś tu jeszcze zagląda?
Author: Tomasz
Date: Mon, 08 Mar 2004 19:47
Date: Mon, 08 Mar 2004 19:47
52 lines
2329 bytes
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]);
}
Re: Czy ktoś tu jeszcze zagląda?
Author: Marek Janaszewski USUNTO. z adre...
Date: Mon, 08 Mar 2004 22:24
Date: Mon, 08 Mar 2004 22:24
27 lines
2018 bytes
2018 bytes
W artykule news:c2iil5$bpr$1...@atlantis.news.tpi.pl, niejaki(a): Tomasz z adresu <kosm...@wp.pl> napisał(a): > 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." [...] Witam! Jakiś obiekt jest niezainicjowany, brak jego instancji stworzonej przy użyciu operatora new albo zwróconej przez jakąś metodę. Znajdź miejsce, w którym ten błąd się pojawia i postaraj się o powołanie instancji odpowiedniego obiektu. P.S. Proszę nadawać wiadomością właściwe tematy, to nie jest dyskusja o popularności tej grupy jak wskazuje temat. To, że jest mało wiadomości nie oznacza, że można propagować złe zwyczaje :-) -- Pozdrawiam, Marek Janaszewski [ j_m...@gazeta.pl ]
Re: Czy ktoś tu jeszcze zagląda?
Author: Marcin Hoppe
Date: Mon, 08 Mar 2004 22:24
Date: Mon, 08 Mar 2004 22:24
18 lines
1490 bytes
1490 bytes
Tomasz wrote: > 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." A ustaliłeś co rzuca Ci ten wyjątek? Czy w rejestrze na pewno masz odpowiedni klucz? -- Marcin Hoppe E-mail: marcin...@gazeta.pl WWW: http://marcinhoppe.republika.pl Gadu Gadu: 2222891
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads