|
Ok,I will repeat what I have said,and please help me
I have a usercontrol which Mycontrol and I want create it's attribute
exam:
protected bool m_TrangThai;
[Browsable(true)]
public Boolean TrangThaiQuanCo
{
get { return this.m_TrangThai; }
set { this.m_TrangThai = value; }
}
My problem I don't know create a combobox as backcolor attribute of Form,so I want to ask you about it
|
|
|
|
|
Hi,
Does anyone know if it's possible to trigger an event whenever a video frame is being refreshed (e.g., every 50 ms for a 20 fps frame rate)? It can be either with DirectX or WMP SDK (or anything else within .NET. Alternatively, I could poll the video player and ask which frame is being played. Can't do that either at this point.
Thank you,
Yigal Agam
|
|
|
|
|
|
I'm not sure if this is the right forum to post this in, but I'm not sure where it fits.
My company distributes some reference books on CD-ROM using 3rd party software called Folio Views. The actual content stays on the CD, but what is called a shadow file gets installed on the user's drive. The shadow file allows the user to highlight and annotate the text with out modifying the actual content (the shadow file acts like an overlay). Because of this the shadow file needs to be modifiable by the user. On Vista, the software gets installed as administrator (after UAC click), but when the user launches the software it loads with the users permissions so they can't write to the shadow file and the load fails. I'm using the setup project built into Visual Studio 2005 right now, but we may buy InstallShield if its better, for this and I can't find an option to set permissions on the files. Is there a custom action I can assign to make the file writable by the "users" group?
Thanks.
|
|
|
|
|
You could fiddle with the permissions in a custom action, yes. This isn't really addressing the root cause of the problem, which is that your shadow file is in the wrong place. I'm guessing you've stuck it in the program files directory - it really should be in the user's profile, under application data, or Documents.
|
|
|
|
|
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
|
|
|
|
|