|
It could be that your not passing in the correct arguments for Explorer.
http://support.microsoft.com/kb/314853[^]
I haven't tried this out in C#, but I ran it from the command line with:
explorer /root,c:\
and it displayed correctly.
|
|
|
|
|
That would be why Knew it had to be something stupid. Thanks mate.
|
|
|
|
|
Huy everybody.
I have a little problem. I need to change a decimal symbol in Regional Settings programmatically on C#. Please help who know how to do this.
Thanks.
modified on Monday, July 14, 2008 10:37 AM
|
|
|
|
|
To change it for your app define a culture.
To change it for the system, I think you have to use SetLocaleInfo in kernel32.dll.
MSDN[^].
Dave
|
|
|
|
|
Thanks. You helped a lot.
|
|
|
|
|
Hello
I am working in C# and developing a desktop application. The main tasks of my application are Live Video Capturing, recording, transmission over LAN and motion detection. All are doing fine. But sometimes while grabbing a frame; it throws memory exception i-e
"Attempted to read or write protected memory. This is often an indication that other memory is corrupt"
at line
b.Save("C:\\abc.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);// b is a bitmap object
///// other code
b.dispose();
and after that it throws exception i-e "A generic error occurred in GDI+". As I m continuously grabbing frames in a loop. So once it throws an exception, it stops working. I m searching over it but still didn't get any solution.
plz help me out
thx
Shanzay
|
|
|
|
|
Does your code interact with other non-managed code? I've seen this when using a C++ DLL from C#.
When the error occurs, what field values does the debugger show in the bitmap object? If they're all the same weird byte value, it may mean that object was already Disposed by another part of the code.
If this is happening, you need to trace backwards to locate where it occurs.
|
|
|
|
|
Hi,
Is there a good way of getting command line paramters into a windows forms app?
I can do this with a console app, obviously, but i'm not sure where to begin to allow a windows forms app to accept params.
thanks,
Jason
|
|
|
|
|
the same way youd get the prams in a console app, accept youll have to send them to the form at Application.Run();
i see the IDE does not give you the string[] in the main method but you should be able to add it like so
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FrmMain(args));
}
remember to catch the string[] args in the constructor of you main form
hope it helps
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
How can i find the main? It's not under Form1.cs obviously.
|
|
|
|
|
its in program.cs
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
Oh i found it nevermind,.
What do you mean the constructor? In my case, Form1_Load?
|
|
|
|
|
in Form1.cs
namespace yourNameSpace
{
public partial class Form1 : Form
{
public From1(string[] myArgsFromProgramDotCS)
{
InitializeComponent();
}
}
}
i suggest you get and read a beginners book, hope this helped
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
Environment.CommandLineArguments IIRC
|
|
|
|
|
|
Example is what? It shows the same stupid approach previously mentioned.
|
|
|
|
|
Why is it stupid?
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
Giorgi Dalakishvili wrote: Why is it stupid?
Because the correct way (Environment.GetCommandLineArgs() ) is much simpler, and not error prone.
|
|
|
|
|
OK, you can add the params parameter to the main method. But to pass them on to the main form you better give the main form a string[] property. Or if you want to use the main form's constructor, be sure not to use the given parameterless constructor, but a second one (which has to call InitializeComponents as well), or the bloody designer will give you hell.
By the way, this is just one of those things usually omitted by beginners' books and unmentioned in MSDN, so I think it's a fair question.
|
|
|
|
|
Frank Horn wrote: OK, you can add the params parameter to the main method. But to pass them on to the main form you better give the main form a string[] property. Or if you want to use the main form's constructor, be sure not to use the given parameterless constructor, but a second one (which has to call InitializeComponents as well), or the bloody designer will give you hell.
Why? There is a perfectly good method for that already. I will mention it again: Environment.GetCommandLineArgs() , it return exactly the same args that was passed to Main (in fact Main does not even need the string[] args parameter).
Frank Horn wrote: By the way, this is just one of those things usually omitted by beginners' books and unmentioned in MSDN, so I think it's a fair question.
It is well documented in MSDN. Getting to read MSDN inside out takes a long time! You just need to know what you are looking for
|
|
|
|
|
You're right of course, leppie. No need to fiddle with the Main() procedure. Should have thought of that. Anyway, I wanted to warn against modifying the form constructor provided by the VS designer cause that's a classical beginner's trap. You take away the standard constructor and can't retrieve your form layout. Happened to me too in my time.
|
|
|
|
|
Hi all,
My requirement is to show a fixed a non editable form in left protion of a form and the right part contains some editable fields which will be filled on the basis of the the form on the left side of the main form.
I have used pannals for seperation of the main page in two but i am unable to find the zooming option for the left pannal(that non editable form) for the better viewing.
Can any body help me with out with concept of zooming of any page in windows application using VS .Net 2005?
Thanks in Advance
Ankur
|
|
|
|
|
Lets say i have a custom control with the following private variable and property
private DateTime myTime = new DateTime();
public DateTime MyTime
{
get
{
return myTime;
}
set
{
myTime = value;
textBox.Text = myTime.TimeOfDay.ToString();
}
}
does the property(specifically the set block) get run upon construction of the control?
Cuz what happening is the textBox is Showing 00:00 at startup and its supposed to be blank...
any ideas?
Thanx
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
HarveySaayman wrote: private DateTime myTime = new DateTime();
HarveySaayman wrote: Cuz what happening is the textBox is Showing 00:00 at startup and its supposed to be blank...
And that's exactly what you told it to do! I am sure you can see the error now
|
|
|
|
|
hey leppie
i get that the variable is 01/01/0001 00:00, but what i dont understand is the set block executing on construction(assumption)...
the Variable should be 01/01/0001 00:00 but in the TextBoxTextChanged_Handler i have something like this...
TextBoxTextChanged(object sender, EventArgs e)
{
try
{
MyTime = DateTime.Parse(((TextBox)sender).Text);
}
catch
{
}
}
so then ONLY when a user changes the text value AND it can be parsed to a DateTime will the property change.
but it seems like the initial 01/01/0001 00:00 value of myTime somehow gets written in my textbox
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|