|
private bool IsNumeric(object value)
{
try
{
double d = System.Double.Parse(value.ToString(), System.Globalization.NumberStyles.Any);
return true;
}
catch
{
return false;
}
}
if (IsNumeric(text1.Text)
string tempvalue = "This is a NUMERIC";
else
string tempvalue = "This is not a NUMERIC";
|
|
|
|
|
Hello,
i have a web service which verifies a signature of a client using CAPICOM.SignedData class. If i verify only the signature everthing is ok, but when i verify the certificates too, jumps the exception.
I do the same in the client side and there is no problem so i deduce that the problem is between CAPICOM and the webService.
I have had many prolems integrating CAPICOM in this project and one of them i solved it modifying the "username" attribute in the "proccesmodel" element in the machine.config file.
I know it would be better if i didn´t use CAPICOM, but it is compulsory for this project.
Thank you for your help and advise.
|
|
|
|
|
I have a question:
I can use reflection to view anything inside and object. But, I have a complex object that contains other objects and collections of other objects.
How can I use reflection to drill down into these contained objects?
I want to pass in the root object and reflect though the entire object graph and display the fields (and values) in a tree view.
Any ideas?
Tony
|
|
|
|
|
This has been done in Reflector, what you will want to do is load the assembly, from that call GetTypes() and iterate through each type. Within each type you will want to look at classes such as MethodInfo , ConstructorInfo , FieldInfo , etc. There are methods within the Type class that will return object arrays of these types.
- Nick Parker My Blog | My Articles
|
|
|
|
|
I would like to do this in the same code (not from an assembly). I certainly can use FieldInfo to see the root objects fields and data, but then I need to move into the contained object. Thats where I am stuck.
Type t = o.GetType();
FieldInfo[] fi = t.GetFields();
foreach (FieldInfo field in fi)
{
Console.WriteLine("Field: {0}\tType: {1}", field.Name, field.FieldType);
}
But, now....how to reflect into the "fields"?
Tony
|
|
|
|
|
|
GetValue returns an object reference. Then how to drill down into contained classes. I have had this questions too.
|
|
|
|
|
|
I've got a custom control which has quite a few properties, and they are all stuck under misc.
I'm sure i read somewhere that they could be set to their own, or an already existing titled section by using an attribute, but i can't find where i read it, or any attributes which look like they might do the job.
Can anyone help me?
Cheers
Cata
|
|
|
|
|
|
I'm trying to begin programming Managed Direct3D with C#.
But whatever I do it won't work.
Not even the sample projects wich come with the SDK won't run.
The error i get is the following:
An unhandled exception of type 'System.NullReferenceException' occurred in microsoft.directx.direct3d.dll
Additional information: Object reference not set to an instance of an object.
It gives the error on the following statment:
device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, presentParams);
If i catch the NullReferenceException and make the program continue as if everything is fine, then i get the message that the program was unable to create a device.
I have installed the managed framework and directx.
DirectDraw seems to work fine cause i can run the sample project wich is included with: Managed DirectX Tutorial Part 1 - The Title Screen (Managed Metroid)
I'm running Windows XP sp2 rc1 with the latest Managed DirectX SDK (summer 2004) and visual studio.net 2003
|
|
|
|
|
Do you have a 3d capable graphics card? I can run all (well most, some HLSL stuff doesnt work on my hardware ATI8500) the samples here.
top secret xacc-ide 0.0.1
|
|
|
|
|
Of course, else i wouln't try :P
For extra information, my system specs:
Asus A7N8X Deluxe
Amd Athlon XP 2700+
512MB ram
Hercules 3D prophet 9800 pro 128mb(an ati radeon 9800 pro)
So i dont think its a hardware problem.
|
|
|
|
|
NhImF wrote:
Hercules 3D prophet 9800 pro 128mb(an ati radeon 9800 pro)
:drool:
I'm not sure what the problem is then. Sorry.
top secret xacc-ide 0.0.1
|
|
|
|
|
This is a weird problem. I'm not sure you're going to get it figured out here. Maybe you screwed the installation somewhere. Try reinstall. Make sure you have all the necessary part of the SDK installed.
|
|
|
|
|
I have a DataGrid bound to an Access 2K database
entering a time in the grid either via a DatetimePicker or directly into the
field the time displays Ok on the grid but will not update the database
using a DateTimepicker I can see that the value is a string all types in
code and XML schema are dateTime, I have saved the time back to a string
field OK
2 date/time fields formatted dd/mm/yyyy HH:mm in Access - same problem when
formatted at short time and Gener
jnc
|
|
|
|
|
Hi
I have a button named button1 on my form, and this is its evetn handler code:
private void button1_Click(object sender, System.EventArgs e)
{
button1.Location.X += 10;
}
but compiler tells me:
Cannot modify the return value of 'System.Windows.Forms.Control.Location' because it is not a variable
Why can't we change the X and Y properties of a Point object?
|
|
|
|
|
Anonymous wrote:
Why can't we change the X and Y properties of a Point object?
Becuase a Point is a valuetype. You will need to reassign the Location to a modifeid Point object.
top secret xacc-ide 0.0.1
|
|
|
|
|
It doesn't make sense at all! Why should we always make a new instance just to change a single property? It's really ridiculous!
|
|
|
|
|
|
I craete an usercontrol that have this property :
public enum enumShowState{horizantal,vertical} ;<br />
private enumShowState m_showState ;<br />
public enumShowState ShowState<br />
{<br />
get{return m_showState;}<br />
set<br />
{<br />
m_showState=value;<br />
SetShowState(value) ;<br />
}<br />
}
when i use it in my other project, this filtered error will be show :
Projects\mph\frmStudAnswer.cs(111): The variable 'enumShowState' is either undeclared or was never assigned.
and when i click on this error, cursor go to this source code :
public class frmStudAnswer : System.Windows.Forms.Form<br />
{<br />
...<br />
...<br />
private void InitializeComponent()<br />
{<br />
<br />
....<br />
...<br />
this.UserControl1.ShowState = Share.UserControl1.enumShowState.horizantal;<br />
... <br />
...<br />
}<br />
...<br />
}
note that i referenced to my UserControl1 project.
please guide me.
|
|
|
|
|
hd_ali@yahoo.com wrote:
this.UserControl1.ShowState = Share.UserControl1.enumShowState.horizantal;
Try not calling your instances the same names as classes (how about some proper names?). This AFAI concerned a resolution bug in C# compiler, that appears in more than one place.
top secret xacc-ide 0.0.1
|
|
|
|
|
How can I get the address of an object (as IntPtr) or any other variable type ?
Though I could get a variable address in unsafe,
(or maybe there is a better c# way ... I dont know)
unsafe
{
int x=0;
int *p=&x;
}
With objects it's not working, and still I have to convert it from int* to IntPtr ...
Thanks
|
|
|
|
|
|
GCHandle hnd = GCHandle.Alloc(object);
InPtr ptr = hnd.AddrOfPinnedObject();
But seriously what are you going to do with it ?
|
|
|
|