|
Try
Texg.Write(" + \\");
Texg.WriteLine("New Text String");
or
Texg.Write(" + \\");
Texg.Write("\r\n");
Texg.Write("New Text String");
|
|
|
|
|
try:
Texg.Write(@" + \");
Texg.Write(Environment.NewLine);
Texg.Write(@"New Text String");
|
|
|
|
|
|
Well - that's a weird cross post.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
When I click on Create a Folder Button as below I get an error-Object reference not set to an instance of an object. How should I get rid of this error-Object reference not set to an instance of an object
private void btnCreate_Click(object sender, EventArgs e)
{
try
{
if (tvFavorites.SelectedNode.Tag == null)
{
OleDbCommand insertfolder = new OleDbCommand("insert into favFolders (folder_name,folder_parent) values('" + txtFolderName.Text + "'," + tvFavorites.SelectedNode.Name + ") ", dbProfiles);
if (dbProfiles.State == ConnectionState.Closed)
dbProfiles.Open();
insertfolder.ExecuteNonQuery();
string folder_id = "";
insertfolder.CommandText = "select max(folder_id) from favFolders";
folder_id = insertfolder.ExecuteScalar().ToString();
dbProfiles.Close();
TreeNode tn = new TreeNode();
tn.Name = folder_id;
tn.Text = txtFolderName.Text;
tvFavorites.Nodes.Add(tn);
}
else
{
OleDbCommand insertfolder = new OleDbCommand("insert into favFolders (folder_name,folder_parent) values('" + txtFolderName.Text + "'," + tvFavorites.SelectedNode.Parent.Name + ") ", dbProfiles);
if (dbProfiles.State == ConnectionState.Closed)
dbProfiles.Open();
insertfolder.ExecuteNonQuery();
string folder_id = "";
insertfolder.CommandText = "select max(folder_id) from favFolders";
folder_id = insertfolder.ExecuteScalar().ToString();
dbProfiles.Close();
TreeNode tn = new TreeNode();
tn.Name = folder_id;
tn.Text = txtFolderName.Text;
tvFavorites.Nodes.Add(tn);
}
txtFolderName.Text = "";
lblFolderName.Visible = false;
txtFolderName.Visible = false;
btnCreate.Visible = false;
btnCancel.Visible = false;
}
catch (Exception ex)
{
func.ErrorReporter(ex, "008010");
//This line opens the specified file or creates it if it does not exist
//Note that you must use a double slash in the string instead
System.IO.FileStream myLog = new System.IO.FileStream("C:\\myFile.txt", System.IO.FileMode.Open);
//Creates the new TraceListener that specifies myLog as the target for the output
TextWriterTraceListener myListener = new TextWriterTraceListener("C:\\myFile.txt");
//Adds myListener to the Listeners collection
Trace.Listeners.Add(myListener);
Trace.Write("Object reference not set to an instance of an object");
Trace.Flush();
}
}
|
|
|
|
|
Somewhere in your code you are attempting to work with an object reference that does not point to an actual object.
You should step through your code using the debugger to identify which object reference is causing the problem.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Thanks for your reply. But I want to know this process of Stepping through the code. Can you please guide me. When I clicked on Debug pulldown menu and clicked on Step Into the application starts to run. What are the next steps I need to take?
|
|
|
|
|
RTFM[^]
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hunt for that cunningly hidden breakpoint option and set it. It's fantastically easy to do with this.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Yes, Actually what I want to do is to see on what line I am getting the error. And can you please guide me through that cunningly hidden breakpoint??
|
|
|
|
|
You don't need a breakpoint, you don't even need a debugger to find the location of an
exception. Two simple steps are sufficient:
1. always look at the entire exception, not just its Message; use Exception.ToString(), it
contains details and a traceback with line numbers
2. tell your IDE to always show source line numbers; in Visual Studio, see menu Tools/Options/
TextEditor
and the same two steps work for a whole range of problems.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
ok I entered Exception.ToString() and the line numbers are displayed. But the addition of Exception.ToString()does not give me any additional information.
|
|
|
|
|
Fine, you did not show/explain actual output, so I don't know how much you already had.
Anyway, since you have a stack traceback, look for the first method name WITH line number,
that is most likely to be where the problem SHOWS; of course as always the cause of the
problem may have happened before that.
"Object reference not set to an instance ..." means you are using an object reference that
holds null rather than a valid object. As in:
myClass something;
something.DoMethod1();
If you want specific help, please clearly explain what you get, how it differs from what
you expect, and show code and exceptions.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi, another newb here, if i had an enum like this:
enum test
{
zero, one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty...
}
How would i display the string instead of the integer in auto tooltip?
I can't make this blog work for me, help?
http://joshsmithonwpf.wordpress.com/2007/09/14/modifying-the-auto-tooltip-of-a-slider/#comment-6921
Also if i would bind the value to a label would numbers be displayed in the label or strings?
How would i bind it to a label even if not using strings for integers in the slider and make strings come out instead?
EDIT: This was a problem of cast:
this.AutoToolTip.Content = (test)Convert.ToInt32(this.AutoToolTip.Content);
EDIT2:has a flaw though, first time i clock the slider's bar only one char wide tooltip appears, how can i change that?
-- modified at 23:25 Saturday 10th November, 2007
|
|
|
|
|
Hi,
I'm currently working on a project to read in an excel file and display it using a DataGrid.
However every time I try to open the connection I get the error - Could not find installable ISAM. I have Office 2007 installed and have also installed the Access Data Acces components.
This is the current code that opens the connection
<br />
OleDbConnection cnCSV = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\test.xlsx;Extended Properties=Excel 12.0;HDR=NO");<br />
cnCSV.Open(); <br />
Does anyone know a work around for the ISAM? Do I need to re-install MDAC?
Paul
|
|
|
|
|
|
Yes it it
"The early bird may get the worm, but the second mouse gets the cheese" - anonymous, found in Uncle John's Bathroom Reader
|
|
|
|
|
Hi, I have a Textbox that I've bound to a property in my business object (Person object, FirstName property).
firstName.databindings.add("text", Person, "FirstName");
Works fine. If I manipulate the Person object and change the FirstName property, I need the textbox to reflect the change.
Other than raising an event to set the textbox.text to the new property value, is there any other way to go about it?
Thanks!
|
|
|
|
|
Refresh?
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
Hi,
I have a list box of items and I want to change the style of the newest item in the list.
I tried some things, but no results...
|
|
|
|
|
gabi_coman wrote: I tried some things, but no results
Does that mean you tried typing some code? Did you try reading? You know reading documentation and articles about how the list box control works so you could "know" how to solve your problem?
|
|
|
|
|
I don't really know what's wrong with what I've wrote. If you put a question on a forum it means that you know the answer?
Thank you for your support, now it's all clear.
|
|
|
|
|
Hy
I have a WebBrowser. Enter to mail.yahoo.com, make the login, after that I change the page. How can I do if I want to re-enter to mail.yahoo.com to not login to my account. I don't want to do Sign Out. I try to create a new instance of the WebBrowser but doesn't work.
thx
|
|
|
|
|
Find the Yahoo cookie stored in temporary internet files and delete it.
There's a better way to do sign into yahoo mail without using a behind-the-scenes-web browser. Use the Yahoo Mail API[^].
|
|
|
|
|
Hello everyone,
I have created a simple WIndows Application which user can download, install, and use it on thier computer. I was wondering if it is possible to make the application functional on IE browser. Would it possible for the user simply get connected and have all the functionality online?
If this is possible, what are the steps that I need to take in order to convert my existing code into a browser base application?
Any information on this issue would be greatly appriciated. Thank you and have a great day.
Khoramdin
|
|
|
|