|
Yes, I did register control using regsvr32.exe
I have been using a lot of ocx control so far and this is the only one give me that error.
Thanks,
Brandon
|
|
|
|
|
Assuming your control got registered successfully, try clearing all the files in obj/debug or obj/release. Now try to add the control again.
If you have problem in registering control using regsvr32 , use dependency walker and profile regsvr32 by specifying the dll to be registered.
|
|
|
|
|
Navaneeth,
I have tried many time to delete the files in obj and debug folder but the error is still there.
I am not sure I have problem using regsvr32 or not since I have used to register a lot of controls so far. All works fine, except this control ecgraph3D.ocx
How can I use dependency walker and profile regsvr32 ?
Many thanks,
Brandon
|
|
|
|
|
brandonwong123 wrote: I am not sure I have problem using regsvr32 or not
The problem is obviously going to be specific to the control.
Does the control come with any samples ? Do they work ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Christian,
The control comes with visual basic 6 example and it works on my machine. This company has ecgraph.ocx and it works on my visual studio 2005. Now they just have ecgraph3D.ocx as their new product but this control doesn't want to work on my C# 2005
Thanks,
Brandon
|
|
|
|
|
So the VB6 sample you have is for the new control, or the old one ? If that works, then the issue is somewhere in how you're importing the file.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Christian,
The VB6 example is for the new control. I just try to add control on different computer and error is the same.
I am not sure what is causing this problem.
Any further help, please let me know.
Thanks,
Brandon
|
|
|
|
|
Hello All,
I hope someone can help. I have a dataGridView populated with data, I have added a dataGridViewComboBoxColumn. The dataGridViewComboBoxColumn is populated per row. That all works great. The issue I am having is getting the value of a dataGridViewComboBoxColumn Cell.
The last thing I tired is:
DataGridViewComboBoxCell cell = dataGridView1[cntR, cntC] as DataGridViewComboBoxCell;
string val = cell.ValueMember.ToString();
string val2 = cell.Value.ToString();
Which always returns "" for both.
Any help would really be great.
j
|
|
|
|
|
i have the same problem
dgvPhysioSession.Rows[rowIndex].Cells["Diagnosis"].Value
it returns null
|
|
|
|
|
Humm this is a puzzler im settings from a .txt file which looks like this
//This is the directory which your downloaded files will be stored in
DownloadFolder = /mnt/md1/public/Downloads
//The telnet user usualy root
TelnetUser = root
//The telnet password
TelnetPassword = root
//The IP of your NAS eg 192.168.2.2
TelnetIP = 192.168.2.2
I want to convert these values into strings eg TelnetIP = 192.168.2.2 so they can be reused on multiple forms . So ive got them importing with a StreamReader below
private void LoadSettings()
{
StreamReader Settings = new StreamReader("Settings.txt");
string line;
while ((line = Settings.ReadLine()) != null)
{
if (line.StartsWith("/"))
{
}
else
{
string[] splitArray = line.Split(new char[] { '=' });
MessageBox.Show(splitArray[0]);
}
}
}
So in this case splitArray[0] gives DownloadFolder and splitArray[1] gives /mnt/md1/public/Downloads perfect but how do i join them back togeather to give
DownloadFolder = /mnt/md1/public/Downloads
And also im getteng blank lines coming through as settings else if (line.StartsWith("/r/n")) or \r\n dosnt seem to catch them
any ideas ? thanks
|
|
|
|
|
I do not know if this will work but I know when I use string you have to be careful of slashes and so on so for one you could try:
private void LoadSettings()
{
StreamReader Settings = new StreamReader("Settings.txt");
string line;
while ((line = Settings.ReadLine()) != null)
{
if (line.StartsWith(@"/"))
{
}
else
{
string[] splitArray = line.Split(new char[] { '=' });
MessageBox.Show(splitArray[0]);
}
}
}
The at symbol will ensure it is read as string....
as for getting the strings back together you could use a string builder or just add the values together
string var = (splitArray[0] + " = " + splitArray[1]);
I am not sure if that is the best way to do it. Hope that helps.
|
|
|
|
|
Hum im getting System.IndexOutOfRangeException was unhandled
Message="Index was outside the bounds of the array."
i think it might have something to do with splitArray[0] being empty , The line brakes seem to have gotten through
|
|
|
|
|
The MSDN on 'is' operator says ...the provided object can be cast to the provided type without causing an exception to be thrown. Suppose I have the following code:
object x = FunctionThatReturnsAnInteger();
if(x is decimal)
Console.WriteLine("Hello world");
The above condition is never true because x is of type integer, not decimal, but - int can be cast to decimal without an exception being thrown - so why does it not work?
More directly to my problem - what is the fastest (in runtime) way to check, if a variable (of type 'object', in general) can be cast to decimal? I can obviously try this in a try-catch block, but I wonder if there are ways that perform better.
Thanks for sugegstions, H.
|
|
|
|
|
These are integral types, is only works for classes. This should not compile. The is operator WILL work with a class structure.
class Base
class Derived1 : Base
Derived1 n;
if ( n is Base )
{
// this will work
}
Member 1033907 wrote: what is the fastest (in runtime) way to check, if a variable (of type 'object', in general) can be cast to decimal?
I suspect you need your try/catch block. You also have the cost of boxing to contend with. You could try calling ToString on the object and then decimal.TryParse, that should work for things like int.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Thanks for your reply.
Christian Graus wrote: This should not compile.
I compiles fine, 'is' works with structures as well. And besides - 'x' in the previous example is of type 'object', so the compiler has no way of knowing it is going to contain an integer.
Christian Graus wrote: You could try calling ToString on the object and then decimal.TryParse, that should work for things like int.
String parsing seems to me like the slowest possible approach. I guess I'll go with the try/catch, which is guaranteed to work, unless someone comes with something faster.
|
|
|
|
|
Member 1033907 wrote: I compiles fine, 'is' works with structures as well.
I didn't think that was the case. I know I've had 'is' not compile for me before because I used an integral type.
Member 1033907 wrote: String parsing seems to me like the slowest possible approach
Well, you're already paying the cost of boxing, which is expensive, and talking about try/catch, which is VERY expensive.
Member 1033907 wrote: I guess I'll go with the try/catch, which is guaranteed to work, unless someone comes with something faster.
I would do some testing to see which is faster.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
I've got it. It's 'as' that doesn't work, because int cannot be null. But, is and as both rely on an inheritance tree, they do not try to do any sort of conversion between types. decimal does not derive from int, or vice versa, so neither of those will work. You're asking if the type can be converted, not if it is of that type to start with.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Member 1033907 wrote: int can be cast to decimal without an exception being thrown - so why does it not work?
Just because you can cast to it does not mean it is part of the same type heirarchy. Types can provide their own casting operators to make coercion to other types easier for the programmer.
is /as only work on things when they are along the same branch of an object heirarchy.
decimal derives from object . int derives from object . Each is heading down different branches.
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
The term "cast" is used to mean two different things, one of which is more like "convert".
When an int is "cast" to decimal it gets converted. The is operator doesn't work with that type of cast.
|
|
|
|
|
I wrote an app which creates excel reports. I would like to kill all the excel processes my application started. How do I figure out if my application started the process so I only kill those processes?
I have this code so far:
foreach (Process p in Process.GetProcessesByName("EXCEL"))
{
p.Kill();
}
However, as it is clear from the code, it kills all excel processes.
CodingYoshi
Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07
|
|
|
|
|
Hi,
AFAIK there ever is only one Excel process; opening an Excel document causes Excel to start if it isn't already running; opening a second Excel document gets directed towards the first Excel process. So you can only kill one Excel process, and doing so may be a mistake since it may have open documents your app did not open. Your app should tell Excel to close documents, and optionally, when no more documents are open, it could tell Excel to exit. Under no circumstances it should kill Excel.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Luc Pattyn wrote: AFAIK there ever is only one Excel process
You can use the .IgnoreRemoteRequests = true property to force excel to open in multiple instances for each workbook, so sometimes you would need a loop.
My question is if he opens excel in his code to generate reports, there is no need to terminate them abnormally, especially when a client may have unrelated excel instances open unrelated to his code. He can simply terminate them through his code by using .quit, can't he?
|
|
|
|
|
No, there are actually separate processes created. Excel 2003
CodingYoshi
Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07
|
|
|
|
|
Why don't you just quit the excel instance through your code?
|
|
|
|
|
I tried Quit() along with setting it to null but the process still existed. Any other idea?
I am thinking of logging the time my app starts and then checking the start time of each process. If the start time is bigger than start time of app and created by the same user then I will kill it. But it is still possible, the user opened an excel file outside my app while my app is active so this is not the best solution.
CodingYoshi
Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07
|
|
|
|