|
No, it's not. There you used a Type object instead of a FieldInfo object.
---
b { font-weight: normal; }
|
|
|
|
|
Have you tried using the Enum struct? Once you have the type of enum you can use the static methods of the Enum struct to obtain information about the enum type.
chriswa
|
|
|
|
|
I got it!!!!
Thanks Chriswa its working as per your suggestion. i have declared the enum as enum class (ie enum struct) in VC++ dll. then i can able to get the enum member names.
If i declare the enum using enum in VC++, then i am not able to retrieve the names.
What is the difference between enum and enum struct
I extend my thanks to Guffa.
Regards,
Srini
|
|
|
|
|
How does one get the current date and time in C#. Is there any readymade class.
|
|
|
|
|
deepscyberpulse wrote: How does one get the current date and time in C#. Is there any readymade class.
DateTime.Now
Share and enjoy.
Sean
|
|
|
|
|
I think that this is what u want.
DateTime d = new DateTime();
MessageBox.Show(d.ToShortDateString());
|
|
|
|
|
Hi, you can use this:
label1.Text = DateTime.Now.ToLongDateString(); //date
label2.Text = DateTime.Now.ToLongTimeString(); //time
Regards,
Alberto Martinez
|
|
|
|
|
Hello
I am working on an application in c# i want to develop a sofware that block the any address that is contain in the database of my appliction. i.e if i have www.yahoo.com in my database and user enter www.yahoo.com in the address bar of the Internet Explorer this site should not be open.
If any one has worked on it or have idea about it plz le me know.
|
|
|
|
|
This sounds like a task better suited for native code. To block addresses on the client machine, you're going to have to write some native hooks into the OS to truely prevent this. If you're just blocking Internet Explorer navigation, you could write hooks or a plugin for IE that blocks the site. Either way, definitely not a task for C# and .NET.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Moral Muscle
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
Judah Himango wrote: definitely not a task for C# and .NET.
Why not?
I agree though that native code is better, but you can accomplish the same thing in .NET
Ed
|
|
|
|
|
I would agree. In fact this sounds like something that you would want to do in ASP.NET of you are blocking the address from the server. It not actually clear in the grandparent that this has to be done on the client. If this has to be done on the client then you can build a plug in from .NET using COM/Interop or build an IE plug-in from COM. It is easier at times to use .NET to write a COM plug-in
chriswa
|
|
|
|
|
ASP.NET? It'd be possible but I'd have thought I'd be better to have a service running on the server / client which interops with the Win32 API.
You notice that's how most firewalls do it
The only major difference would be that it would be written in .NET with COM Interop rather than in native code.
Ed
|
|
|
|
|
Hi all
i have displayed a CSV file (coma separated) in a richtextbox,
but now need to put it into an Ilist
Anyone got any ideas ??
Thanks lots
John
|
|
|
|
|
Search this site for CSV parsers. There are many out there freely available.
|
|
|
|
|
What would be the equivalent in C# for the following?
Sub CreateADODB()<br />
Dim adoApp As Object<br />
adoApp = CreateObject("ADODB.Connection")<br />
End Sub<br />
Is there a site where you can enter functions of VB and see what the C# (and/or other languages) are?
thanks!
No hurries, no worries.
|
|
|
|
|
This is simple and tough to answer - so here goes.
Simple: ADODB.COnnection was replaced by OleDbConnection in the System.Data assembly
Tough: CreateObject was used in VB and VBScript in create an instance of a COM compatible object. ADODB.Connection was a very commonly used COM Object for connecting to a variet of databases. .NET, and therefore C#, has much interoperability with COM if you did want to look that up and use the, now mostly defunk, ADODB COM libraries.
|
|
|
|
|
actually it was the CreateObject I needed, the ADO stuff was just an example.
I need to use a COM object and in VB they've used a CreateObject to call it.
I've tried via the tlb and exe file, but I get an errormessage. Now I thought to use the same code they've used in VB, but in C#.
thanks a lot!
[EDIT]I've found a little exe here in CP, but it isn't wat I need...[/EDIT]
No hurries, no worries.
-- modified at 8:23 Friday 17th March, 2006
|
|
|
|
|
Ah, in which case if you are using Visal Studio, just add a COM reference to the project (right click references>Add reference>COM Tab>Browse) and VS will do the rest for you, allowing you to call the COM object as if it were a .NET class. Visual Studio just does some boiler-plating for you.
eg, if I did this with ADODB.COnnection I could go
ADODB.ConnectionClass myConn = new ADODB.ConnectionClass();
note it adds the suffix "Class" to the COM Object's true name.
|
|
|
|
|
Actually I've tried to import the dll and the tlb file, but I got an error message, BUT I did find a solution:
Import the Microsoft.VisualBasic Object (yes, I know )
and use the following (example)
object idisp;<br />
<br />
try{<br />
idisp = Interaction.CreateObject("idisp.Command", null);<br />
bidisp = true;<br />
}<br />
catch(Exception e){<br />
bidisp = false;<br />
MessageBox.Show(e + "");<br />
}
And it worked .
I'm not sure if there is a complete C# solution.
tnx for the effort!!
No hurries, no worries.
|
|
|
|
|
I examined the CreateObject class, and doing the same without it is not so hard:
object idisp;<br />
bool bidisp;<br />
<br />
try {<br />
idisp = Activator.CreateInstance(Type.GetTypeFromProgID("idisp.Command"));<br />
bidisp = true;<br />
} catch (Exception e) {<br />
bidisp = false;<br />
MessageBox.Show(e + "");<br />
}
---
b { font-weight: normal; }
|
|
|
|
|
Try the SQL/ADO forum for more info.
BUT here's what I have done:
ODBC - Easy to do in C#, there are tons of article here. Worst part is the DSN as you eithe rhave to manually provision it OR use on of the autmation techniques you find on CodeProject - and trust me when I say there are a few. You can use this with MySQL, or other non Microsoft DBs as opposed to delving into the C based APIs. If your app is running on say Linux this might be a good option.
OLE DB - Not really for your relational databases per se, but if you have data stores like Excel or other spreadsheets, or office files, it works great and again pretty easily once you know the finer configuration points.
SQLClient - If you are using SQL Server then this is probably the best route because of the inherent support.
All of the options Odbc, OleDb, and SqlClient have a similar data model. You should be able to find code here, of course on MSDN, and throughout other sites.
Good luck
Mike Luster
CTI/IVR/Telephony SME
|
|
|
|
|
tnx but I'm not going to the db, it was the CreateObject I needed and so far I was succesful (see complete thread)
tnx!
No hurries, no worries.
|
|
|
|
|
Hi all C# Gurus,
Is it possible to rotate images using GDI or anything else.
If yes (it must be) then please guide me through the process.
Also, it would be nice if anyone can tell me how to read from XML files.
Or alternately, please let me know any article on the same which i have surely missed .
Thanks in advance.
Any help will be highly appreciated.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
Hello!!
Well about rotate images i know a library in C# where you can draw many figures and insert images and you can rotate, scale and a lot more it's pretty cool:
http://www.cs.umd.edu/hcil/piccolo/[^]
Regards,
Alberto Martinez
|
|
|
|
|
An easy way to draw rotated image is to use transformations:
Graphics g = ...;
g.RotateTransform(angle);
g.DrawImage(...)
if you want to rotate around any point, you can use matrix.
Matrix m = new Matrix();
m.RotateAt(angle, new PointF(x, y));
g.Transform = m;
g.DrawImage(...);
|
|
|
|