|
How can i get windows default currency symbol as i can see it in windows reginal setting?
Thanks in advance
|
|
|
|
|
|
I'm getting a Null Reference Exception when using a COM object. The error occurs randomly, or so it seems, with nothing obvious to distinguish the runs when the error occurs and when it does not. As it so happens, the COM object connects to a particular software called Think & DO. When the other software runs on the PC, the COM object works perfectly, but when the other software runs on a Programmable Logic Controller (PLC)-and C# connects via the COM object directly to the PLC, the object is unreliable. Without knowing the details of the COM object, is there any advice someone can give me regarding how to discover the error I'm getting?
|
|
|
|
|
I'm trying to use the CrystalDecisions assembly to access Crystal Reports. To do this, I need to get the user's authentication information so I can authenticate into Crystal Reports itself. I want to do this with the user's windows authentication so the user is saved the trouble of having to log in.
Here's where I'm putting the information:
<br />
CrystalDecisions.Shared.ConnectionInfo crConnectionInfo = new CrystalDecisions.Shared.ConnectionInfo;<br />
<br />
crConnectionInfo.ServerName = "ServerName";<br />
crConnectionInfo.DatabaseName = "DBName";<br />
crConnectionInfo.UserID = "UserID";<br />
crConnectionInfo.Password = "Password";<br />
ServerName and DBName are key values in my web.config file, so they're easy. Getting the current user's UserID from System.Security is also pretty straightforward. What I can't find is a way to extract the password from somewhere.
I realize there may be security in place specifically to prevent exactly what I'm trying to do, but has anybody come across a way to do it? Perhaps finding the user's object on the AD? Perhaps pulling it from Windows somewhere? Perhaps a way to pass a security token to Crystal Reports?
Thanks for your help!
|
|
|
|
|
If I remember correctly, the user's password is encrypted using a one way hash. So even if you could find it there would be nothing you could do with it. When you type a password in Windows it performs the same one way hash and compares the two hash values. This way, if the passwords are compromised there would be no way to get back to the original password.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
I am trying to draw text with an Outline and Gradient colors. The easy part was the Gradient Colors, it was basically call Graphics.DrawString with the required colors in the LinearGradientBrush. Now the hard seems to be how do I draw the Text with the Outline basically the alphabet 'A' will have have a black outline with the color filled in.
Can someone point me in the right direction on how to do this.
Thanks in advance
|
|
|
|
|
I suspect the way to go is to get the path for the string, and then draw that.
GraphicsPath path = new GraphicsPath();
path.AddString("draw this", FontFamily.GenericSerif, 0, 20, new Point(0, 0), StringFormat.GenericTypographic);
e.Graphics.DrawPath(Pens.Black, path);
This will draw the outline after you've drawn the 'inside' with a texture brush.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Is there any way to make a conditional compilation statement that can determine if the user has vs.net 2003 or 2005?
eg:
#if vs2003
do stuff
#else
do other stuff
#endif
Im fairly sure Ive seen #if NET2 before , but that evaluates false in 2005 now.
(ok maybe it was in a project that had a define for net2)
so is it possible to determine if the user is compiling for 2.0 or 1.1 w/o adding different build options to your solution?
|
|
|
|
|
|
Hi all,
I am working at a research lab as a porgrammer. By the time I joined the lab, everything is in MFC and all the interfaces doesn't look good in their appereance. I am planning to recreate them in C#, before that I need to know your suggestions on it. Also all these programs are having some manufacturers library and header files (written in c/c++) added to them, which are used to interact with their respective hardware.
Before that I need to know whether it is possible to recreate the code in c# using the code written in c++. I would be happy to provide with anymore information you need to understand my problem more clearly.
thanks in advance,
-Pav
|
|
|
|
|
You can use p\invoke to call any c/c++ function from a dll. depending on the complexity of the data structures involved it could get rather hairy. There's no need to rewrite the 3rd party control libraries, and if the mfc app seperated computation from gui, you can wrap all the old backend classes and only have to write a new gui for it. One potential thing to consider while contemplating a gui rewrite now, in about a year vista will be out with a new UI and different API to program against. It might not be the best of ideas to modernize the UI when it will become obsoleted again soon.
|
|
|
|
|
Hi,
thanks for your reply. Yeh Win-Vista seems to be more powerful and chanllenging. But since the present code is old enough and I think its time to recreate and modify the UI. At present, as i told we are using third party libraries and cpp files, I want to know if its possible to use the same files and libraries without modifying them while modifying just the UI part using the actual application cpp files and any other cpp files created for the application. If its possible, how can I start off with it.
The present application is used to interact with the research cameras to capture images and display them live in the application window and some more image processing techniues.
thanks,
-Pav
|
|
|
|
|
Is there any way to reflect the changes made in a user control in design time to be reflected in the actual lying controls??
- suppose u have a list view control in a user control.
- U add ur user control to a form and then resize the listview headers.
- After buidling the solution u still have the size U set when u originally designed the user control.
- U change the Modifer's in the user control to "public" still no change.
- Then u think the only way to overcome this problem is by providing browsable properties from the user control to set the properties u need in the hosted controls ?
- But is there any way this can be done "EASY WAY" ?
|
|
|
|
|
I have a large C# application with many threads and queues. There is also heavy use of ArrayList and Hashtable objects that contain many different types of objects themselves.
How can I, in a simple way, prevent all of these objects (including some embedded objects) from being Garbage collected?
PS. Very sorry about the previous messed up message...
|
|
|
|
|
Keep a reference to them in some object that will last the application's lifetime. For example, if you have a main form that will be opened throughout the app's lifetime, store the hashtable as a variable in the form. The hashtable won't get garbage collected.
You may also want to look at the System.GC.KeepAlive method.
p.s. you might want to delete your duplicate message below.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Bought a House!
Judah Himango
|
|
|
|
|
Hi,
I have posted this question a few days ago and have recieved some answers but still can't seem yto get this to work. I want to pass the value of a
NumericUpDown control as a parameter to draw a line on a WinForm. The line will be drawn when the Button is clicked. I think I'm not setting the bool flag that determines if the line should be drawn correctly --
//Why doesn't this work?? -- thanks in advance......
private bool goAheadAndDrawTheLine;
private void Form1_Paint( object sender, System.Windows.Forms.PaintEventArgs e )
{
Graphics g = e.Graphics;
if( goAheadAndDrawTheLine )
DrawMyLine(g);
}
public void DrawMyLine( Graphics g )
{
{
g.DrawLine( somePen, 0, 0, 100, this.numericUpDown1.Value );
}
}
private void DrawA_Click( object sender, System.EventArgs e )
{
goAheadAndDrawTheLine = true;
}
|
|
|
|
|
Add a this.Invalidate() to the button click event. This forces the form to call OnPaint.
Also you should override the OnPaint method so that you can add your code to do the drawing when ever the form is redrawn.
|
|
|
|
|
If you click the DrawA button, it will then set the goAheadAndDrawTheLine to true. However, your form won't get painted magically; either the form has to be redrawn (for example, resizing the form will force a redraw) or your code has to tell the form to be redrawn. When the form is redrawn, the Form1_Paint event will occur, and the line we be drawn.
To force your form to be redrawn from code, call yourForm.Invalidate().
So to make your code work:
private void DrawA_Click( object sender, System.EventArgs e )
{
goAheadAndDrawTheLine = true;
this.Invalidate();
}
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Bought a House!
Judah Himango
|
|
|
|
|
Bingo. Works great now. Thanks for the help.
|
|
|
|
|
Recently I have created a control for my project. This control is basiclly a panel grouping 2 labels and a button.
I added this control to my main form. I need to add a click even to it so that it will bring up a message box.
When i dbl click on the control in the design view, it creates me a load event. I need a click event, so i manually added a click event in the properties.
I run the program and click on the panelgroup, it has no response. It seems like that event is not there, or doing nothing. I tried printing out a message and it doesnt
Can any one help? Is it because i need to create a click event in side the control??
-- modified at 12:16 Monday 28th November, 2005
|
|
|
|
|
Keep in mind the click event will only be raised if you click the control itself, not the labels or buttons on the control.
If you already know that, and it's still not working when you click the control (but not the labels or button), then we'd need to see some code in order to help you.
Also, to be clear, please tell us exactly what you're trying to do. Do you want your PanelGroup control to raise a Click event when any of the labels or buttons are clicked? Or do you want to create a custom event?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Bought a House!
Judah Himango
|
|
|
|
|
Assuming that you want the instantiating class to receive a click event when the user clicks on the button in the user control, then you need to create an event/delegate pair in your user control - like this...
public delegate void ButtonClickedDelegate();
public event ButtonClickedDelegate OnButtonClicked;
Next, you need to create, within your user control, an event handler for the click event for your button using the IDE and include something like this for your event handler...
void myButton_Click (object sender, System.EventArgs e)
{
if (OnButtonClicked != null)
OnButtonClicked();
}
When you add your user control to a new project, then this public event you have declared should show up in the event list for the user control in the IDE. You can then specify an event handler for this custom event and receive the event within the instantiating class.
Darryl Borden
Principal IT Analyst
dborden@eprod.com
|
|
|
|
|
I get the "setup error-> failed to load resoures from resource file please check your setup." whay ??/
|
|
|
|
|
|
I'm still interfacing to an unmanaged C++ camera library with this code
typedef struct<br />
{<br />
void* pBuffer;<br />
unsigned long bufferSize;<br />
} CamFrame;
In C++ all is have to do for varying bufferSize is
myCamFrame.pBuffer = new char[myCamFrame.bufferSize];
then later call
GetCameraFrame(camHandle,&myCamFrame);
In C# I have
[StructLayoutAttribute(LayoutKind.Explicit)]<br />
public struct CamFrame<br />
{<br />
[FieldOffsetAttribute(0)]<br />
private IntPtr pBuffer;<br />
[FieldOffsetAttribute(4)]<br />
private uint bufferSize;<br />
}<br />
and <br />
GetCameraFrame(IntPtr camHandle, ref MyCamFrame);<br />
<br />
What I can't work out is how to allocate the necessary buffer (e.g using byte[] ) and then get the void pointer. Some things I've tried compile but the call to GetCameraFrame goes off into la-la land somewhere. I suspect this related to marshalling.
Ideas anyone?
Stewart DIBBS
|
|
|
|