|
Yeah, unfortunately I have to work within the bounds of some third party software and there isn't a way to automatically generate a new shadow file for each user so I need to do it this way. Do you know what the command should be in the custom action?
|
|
|
|
|
Ah well if you add a custom action, then you should be able to use the System.IO.File.GetAccessControl(name); to get a FileSecurity object, and then use fsec.AddAccessRule(new FileSystemAccessRule(...));
|
|
|
|
|
What I need to do is append the string " + \" to the last line of a file and then go to the next line and write a string. It would seem something like this should work.
Texg.Write(" + \\");
Texg.Write("\n");
Texg.Write("New Text String");
I get this as output where the @ sign is a rectangle:
+ \ @ A Text String + \@ A Text String + \@ A Text String
What I want is:
+ \
A Text String + \
A Text String + \
A Text String
This is easy in C++ and I am sure I missing something obvious.
|
|
|
|
|
|
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?
|
|
|
|