|
Hope to use C# for ActiveX in Excel VBA. Success to call as COM, but fail to add the control from "Control Toolbox" as ActiveX
I want to use C# for ActiveX in Excel, but fail to add the control from "Control Toolbox".
I have write a COM object using C#, and I can call those function in Excel VBA normally.
But when I try to change it as a ActiveX, I fail.
The Excel can detect my COM object as a ActiveX, that means it can show in the "Control Toolbox".
Once I select it, and try to put it in the Excel, it show me a dialog box said "Cannot insert object".
I have read the following link about the error message, but for my ActiveX in C# do not have the .odl file.
http://support.microsoft.com/default.aspx/kb/171280/
Can any one give me some hints?
|
|
|
|
|
Hi.
My app can be started with different command line parameters. Some of these may represent date values. So what I do is convert the string taken from the command line into a DateTime object using the Convert.ToDateTime() method.
What format should the string resemble in order to be sure that the conversion is ALWAYS possible and successful REGARDLESS of the local/language settings of the machine that runs the program?
Thank you.
|
|
|
|
|
blackjack2150 wrote: What format should the string resemble in order to be sure that the conversion is ALWAYS possible and successful REGARDLESS of the local/language settings of the machine that runs the program?
You can pass IFormatProvider as second argument of Convert.ToDateTime . Convert will then parse string according to that format, regardless of local settings.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
By telling the user what format to use
Some examples from DOS:
XCOPY
/D:m-d-y Copies files changed on or after the specified date.
SCHTASKS /CREATE
/SD startdate Specifies the first date on which the
task runs. The format is
"yyyy/mm/dd".
And of course you should require an ISO 8601-compliant format, like "YYYY-MM-DD".
|
|
|
|
|
blackjack2150 wrote: What format should the string resemble in order to be sure that the conversion is ALWAYS possible and successful REGARDLESS of the local/language settings of the machine that runs the program
You would want to use one of the ISO 8601 formats. If you just need the date portion it should be YYYY-MM-DD or YYYYMMDD . If you need the time portion as well it should be YYYY-MM-DDTHH:MM:SS or YYYYMMDDTHHMMSS (where T is the literal character "T").
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Dear Gurus,
Does enyone know how I can set Image dynamically to my Button Background and delete that image from my PC?
I use Image.FromFile(@"C:\myImage.png") in my
When I try to delete image Error message apears "File used by another programm".
Thanks.
Vas
|
|
|
|
|
Opening an image from a file, locks the file. If you copy that image to a new image, dispose of the old one, then you can delete it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thank you for your answer.
but I wanted to know is there another way without copying file.
I'll try to describe my situation. I have created application which downloads Button Images form the remote server and shows to the Users. when Application tries to download the Image which already downloaded I wont to ovverride it but error occures.
|
|
|
|
|
Try something like this:
Bitmap BMP = new Bitmap(@"C:\myImage.png");<br />
Bitmap BMP2 = BMP;<br />
<br />
button1.BackgroundImage = BMP2;<br />
<br />
BMP.Dispose();<br />
System.IO.File.Delete(@"C:\myImage.png");
|
|
|
|
|
Thank you for your answer.
but I wanted to know is there another way without copying file.
I'll try to describe my situation. I have created application which downloads Button Images form the remote server and shows to the Users. when Application tries to download the Image which already downloaded I wont to ovverride it but error occures.
|
|
|
|
|
Hi
I want to know how to make mouse pointer visible within a windows form only.
Since iam working on a windows application, in that I should not allow mouse pointer to be visible when the mouse pointer comes outside the form.
Thanks in Advance For Ur Help
|
|
|
|
|
What's with the flood of non descriptive headers tonight ? Everyone on this forum is asking for help in some regard, probably about C#.
You can capture the mouse, and as it moves out of your form area, you can set the cursor to be null.
Seems nasty to me, tho.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I am retriving Date from SqlServer 2005 but i gets date and time instead that i want only date how should i do it?
|
|
|
|
|
First, C# is not a useful header, imagine if everyone put C#, the forum would look a little silly, right ?
There is no Date type in C#, only DateTime. You can ignore the time, if you want to.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
MyDateTime.Date will return a new object with the time element reset to midnight.
|
|
|
|
|
you can also format the date
Datetime datetime=Person.subscribedate;
datetime.tostring("d");
|
|
|
|
|
you should return only date from sql
you can use convert function
forexample
convert(datecolumn,varchar,101)
it'll only return date not time
|
|
|
|
|
Hi,
System.ComponentModel.Design.IReferenceService.GetComponent() is described by MS here:
http://msdn2.microsoft.com/en-us/library/system.componentmodel.design.ireferenceservice.getcomponent.aspx
unfortunately the do not offer example code.
This is what I know:
If a component is sited, you can get the IReferenceService by a call of Site.GetService()...
this works fine.
My Problem:
with C# Express at DesignTime, I always get:
Parent.Equals(myComponent) == true
as a result of this kind of code:
Component myComponent;<br />
IReferenceService refSvc;<br />
[...].br />
IComponent Parent = refSvc.GetComponent(myComponent);<br />
Am I doing something wrong, or is this a bug?
best regards,
Bernd
|
|
|
|
|
no one knows?
no ideas?
Am I describing anything unclear?
This is about writing a custom UITypeEditor for replacing the buildin one for a property like this:
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]<br />
public Component Owner<br />
{<br />
get { return this._Owner; }<br />
set { this._Owner = value; }<br />
}
The build in Editor allows choosing components from a toolbox, which are private Fields in the BaseClass of my Form. The result is, that the code added by the designer cannot be compiled anymore, if such a component is chosen.
I am also experimenting with IInheritanceService and IDesignerHost to solve this... I already have a DropDown Editor that works, but till now I cannot filter the shown components properly...
Normal Reflection is no help here, as Reflection does not work on the RootComponent of the Designer...
... I'll check if TypeDescriptor solves the Reflection lack...
So the complete Problem I have to deal with:
How to find out if a Component in DesignMode is a field of the Designers RootComponent or a public or protected (but not private) field of the RootComponents base class...
best regards,
Bernd
|
|
|
|
|
I solved the complete Problem, but without IReferenceService.GetComponent()...
... would still be interresting if anyone knows about this...
My solution:
Get the RootComponent with IDesignerHost
Check if the Component you want to use is a Field of the RootComponent by using Reflection:
FieldInfo FI = RootComponent.GetType().GetField(ComponentName, BindingAttributes...);
-> as Reflection on the RootComponent itself is not possible, you will only get Results for Fields of a BaseType
-> you can get also private fields of the BaseType (The code needs ReflectionPermission!)
-> you can be (almost) sure, that all Components for which you cannot find fields, are Components with fields in the RootComponent.
-> all Components with fields in the RootComponent are accessible
-> all private fields you got by reflection are not accessible
best regards,
Bernd
|
|
|
|
|
Hi,
How to make a button transparent?
|
|
|
|
|
Set the Opacity property to something less than 100%
|
|
|
|
|
Button does not ve a opacity property as far of my knowledge
|
|
|
|
|
Button control provides the opacity function ???????????????????
|
|
|
|
|
Hi,
you can set the BackColor property of the button to Color.Transparent
Manoj
Never Give up
|
|
|
|