Click here to Skip to main content
15,914,488 members
Home / Discussions / C#
   

C#

 
QuestionDetect Program Accessing Internet Pin
redfish342-Feb-06 16:05
redfish342-Feb-06 16:05 
AnswerRe: Detect Program Accessing Internet Pin
Dave Kreskowiak2-Feb-06 17:31
mveDave Kreskowiak2-Feb-06 17:31 
GeneralRe: Detect Program Accessing Internet Pin
redfish342-Feb-06 19:03
redfish342-Feb-06 19:03 
GeneralRe: Detect Program Accessing Internet Pin
Dave Kreskowiak3-Feb-06 1:29
mveDave Kreskowiak3-Feb-06 1:29 
AnswerRe: Detect Program Accessing Internet Pin
Dave McCool7-Feb-06 2:15
Dave McCool7-Feb-06 2:15 
QuestionListView SelectedIndices / SelectedItems Questions. Please help!!! Pin
tengpo2-Feb-06 14:58
tengpo2-Feb-06 14:58 
AnswerRe: ListView SelectedIndices / SelectedItems Questions. Please help!!! Pin
Gokulan Venattil2-Feb-06 18:05
Gokulan Venattil2-Feb-06 18:05 
QuestionObject reference not set to an instance of an object Pin
RobertF572-Feb-06 14:14
RobertF572-Feb-06 14:14 
I know this is a really stupid question, but why am I getting the above error at the line
in my codebehind when I set the Label1.Text variable? I set runat to server in my code
page and I've declared the control in my codebehind. I would think that the variable
would be accessible anywhere in the codebehind page.

Thanks. Confused | :confused:

// Codepage:
<asp:label runat="server" id="Label1">// Codebehind:
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Repeater Repeater1;

private void Page_Load(object sender, System.EventArgs e)
{
string connString = "Data Source=(local);Initial Catalog=MyTable;User ID=MyUID; Password=MyPwd;";
string sqlString = "SELECT Column1, Column2 FROM SomeTable";

try
{
using (SqlConnection conn = new SqlConnection(connString))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand(sqlString, conn))
{
SqlDataReader rdr = cmd.ExecuteReader();
if (rdr.Read())
{
Repeater1.DataSource = rdr;
Repeater1.DataBind();
}
}
}
}
catch
{
Label1.Text = "Error!"; // <- Object reference error occurs here
}
}
}
AnswerRe: Object reference not set to an instance of an object Pin
imsathy2-Feb-06 18:19
imsathy2-Feb-06 18:19 
GeneralRe: Object reference not set to an instance of an object Pin
RobertF572-Feb-06 18:35
RobertF572-Feb-06 18:35 
GeneralRe: Object reference not set to an instance of an object Pin
imsathy2-Feb-06 18:41
imsathy2-Feb-06 18:41 
GeneralRe: Object reference not set to an instance of an object Pin
Guffa2-Feb-06 18:57
Guffa2-Feb-06 18:57 
QuestionPersisting a Checked Listbox in the Visual Studio Designer Pin
bah73032-Feb-06 13:14
bah73032-Feb-06 13:14 
QuestionOpenLDAP and .NET Pin
Jan Szumiec2-Feb-06 13:08
Jan Szumiec2-Feb-06 13:08 
AnswerRe: OpenLDAP and .NET Pin
osamahmirza9-Feb-06 17:56
osamahmirza9-Feb-06 17:56 
QuestionOrganizing my project Pin
peterchen2-Feb-06 11:54
peterchen2-Feb-06 11:54 
QuestionLib Files Help please Pin
DocH0liday2-Feb-06 11:53
DocH0liday2-Feb-06 11:53 
QuestionVirual Serial Port Pin
Ross King2-Feb-06 11:43
Ross King2-Feb-06 11:43 
AnswerRe: Virual Serial Port Pin
bskirkman2-Feb-06 17:48
bskirkman2-Feb-06 17:48 
AnswerRe: Virual Serial Port Pin
vikas amin24-Jul-08 11:41
vikas amin24-Jul-08 11:41 
QuestionDelegates from dynamically loaded DLL Pin
Tepel2-Feb-06 11:39
Tepel2-Feb-06 11:39 
AnswerRe: Delegates from dynamically loaded DLL Pin
leppie2-Feb-06 11:58
leppie2-Feb-06 11:58 
GeneralRe: Delegates from dynamically loaded DLL Pin
Tepel2-Feb-06 12:14
Tepel2-Feb-06 12:14 
Questionturn GUI program into service Pin
BlackDice2-Feb-06 11:29
BlackDice2-Feb-06 11:29 
AnswerRe: turn GUI program into service Pin
malharone2-Feb-06 11:39
malharone2-Feb-06 11:39 

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.