|
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(...);
|
|
|
|
|
When working with a C# project, is it possible to get the exact path of the currently open project via code so that it can be displayed say in a messagebox or a textbox ??
|
|
|
|
|
hope this will help you
MessageBox.Show(Application.ExecutablePath.ToString());
this wil return the path of exe
-- modified at 7:56 Friday 17th March, 2006
|
|
|
|
|
Hi,
Can you please specify what did you mean by 'currently open project'? Do you want to know the physical path in Visual Studio .Net? or when you are running the application?
Jim
Work smart, not hard
|
|
|
|
|
Hi gurus,
I have an automation add-in created using C# for Excel, in which I am
exposing a number of functions. Is there any way I can add help-text
the way excel does for other categories like Financial, Statistical,
etc.
The place I want my help-text to be available is in the
Insert->Function. Here, we can select a category and function. The
corresponding help text is displayed. Now, my automation add-in is
also listed in this categories. I want help text to be displayed when a
user selects my add-in and functions in it.
I tried the MacroOptions method, but it is raising an exception.
This is the code I tried (I tried both early binding and late binding):
early binding:
code:
_excelApplication.MacroOptions("Report_Alloc", "custom description", Missing.Value,
Missing.Value, Missing.Value, Missing.Value, "Report.Report", Missing.Value, Missing.Value, Missing.Value);
Exception Message: "Exception from HRESULT: 0x800A03EC."
StackTrace " at Microsoft.Office.Interop.Excel._Application.MacroOptions(Object Macro, Object Description, Object HasMenu, Object MenuText, Object HasShortcutKey, Object ShortcutKey, Object Category, Object StatusBar, Object HelpContextID, Object HelpFile)\r\n at .......
late binding:
code:
object[] parameters = new object[10];
parameters[0] = "Report_Alloc";
parameters[1] = "Some sample description...";
parameters[2] = Missing.Value;
parameters[3] = Missing.Value;
parameters[4] = Missing.Value;
parameters[5] = Missing.Value;
parameters[6] = "Report.Report";
parameters[7] = Missing.Value;
parameters[8] = Missing.Value;
parameters[9] = Missing.Value;
_excelApplication.GetType().InvokeMember("MacroOptions", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, _excelApplication, parameters, new System.Globalization.CultureInfo("en-US"));
Exception Message: "Exception has been thrown by the target of an invocation."
StackTrace " at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)\r\n at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters)\r\n at ......
Inner Exception Message: "MacroOptions method of Application class failed"
Any help would be appreciated.....
Jim
|
|
|
|
|
Does anyone of you can tell why the following code:
private void HandleKeyPress(object sender, KeyPressEventArgs e)<br />
{<br />
char c = e.KeyChar;<br />
<br />
if(c == (short)Keys.Back)<br />
{<br />
e.Handled = true;<br />
SendKeys.Send("{LEFT}");<br />
return;<br />
}<br />
}
works in common textBox but it doesn`t work in richTextBox?
In textBox line e.Handled = true; stops the backspace key action and only action after pressing bakcspace key is move the cursor to left (SendKeys.Send("{LEFT}"); ).
In richTextBox it`s taken double action. e.Handled = true; code doesn`t block backspace key action so:
1) first it deletes character (backspace key do it - it isn`t block)
2) second it moves the cursor to left (like SendKeys.Send("{LEFT}"); code do)
Can anyone figure out what`s wrong with it?
|
|
|
|
|
Try this
private void richTextBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode.Equals(Keys.Back))
{
e.SuppressKeyPress = true;
SendKeys.Send("{LEFT}");
return;
}
}
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode.Equals(Keys.Back))
{
e.SuppressKeyPress = true;
SendKeys.Send("{LEFT}");
return;
}
}
|
|
|
|
|
It`s working
Thank you very much
But code
e.SuppressKeyPress = true; I turned into e.Handled = true;
-- modified at 9:50 Friday 17th March, 2006
|
|
|
|
|
Hello!
how can i show and hide a Quick Launch Toolbar or Desktop Toolbar (which are present in the TaskBar Context Menu --> ToolBar) using C# application.
|
|
|
|
|
Hello!
I have wrote a code in which i m trying to hide the Notification icon when i click on the context menu (which pops on that icon). BUt in this manner two events fire. One which is my event written in the code(which works according to my requirement) and other is the Windows own event, which is Taskbar Popup menu. which always seems bad. if i call any messagebox after that fired events, the windows event hide but i don't want to show message box. Please help me.
|
|
|
|
|
Hi,
Sorry to disappoint you, but i wanted to ask my own question in this.
Are you able to detect when the user is clicking on the window in the taskbar?
Actually, i have made a program in which i have made the FormBorderStyle as None. This prevents the system menu to appear when i click on the window in the taskbar.
So, i wanted to figure out a way in which i could detect a click on the taskbar window and display the menu manually.
Please let me know, if you happen to know about this.
Thanks in advance.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
|