|
What was the COM exception?
|
|
|
|
|
The exception was thrown was System.InteropService.COMException, the error message was : class is not licensed for use.
Other than that, it doesn't have any other error. Please note that it works fine on the machine that has both .NET Studio and VB6 installed...but not others.
Jimmy
|
|
|
|
|
Is it the lciense file for the OCX. I think the corresponding OCA has something to do with this but what do I know...
|
|
|
|
|
I copied the OCA file with it as well...but nothing works. as I mention, this is odd since the winform version works fine, but the service one doesn't.
|
|
|
|
|
We are having the same problem and have talked with MS. It seems like MSCOMM32.OCX requires some kind of certificate before it can be used, and that certificate is installed when you install VB6.
Our way around it is this:
http://msdn.microsoft.com/msdnmag/issues/02/10/NETSerialComm/
Hope this helps,
Mads
|
|
|
|
|
I am using both exception handling and inheritance in my visual basic project. I am curious how .NET handles exception handling between a base class and its derived classes. For example, if the base class method throws an exception and this method is invoked by the derived class, is it necessary to catch and handle that exception in the derived class? Or is the call to the base class method considered to be "inline"?
Thanks!
|
|
|
|
|
If an unhandled exception occurs in your base class, that exception will "bubble" up to your derived class. For example, the following:
Public Class BaseClassThrowsExceptions<br />
<br />
Public Sub MethodOne()<br />
Try<br />
Throw New ApplicationException("This is an handled exception")<br />
Catch ex As Exception<br />
Console.WriteLine("Exception: " + ex.Message + " -- handled by Base Class")<br />
End Try<br />
End Sub<br />
<br />
Public Sub MethodTwo()<br />
Throw New ApplicationException("This is an unhandled exception")<br />
End Sub<br />
<br />
End Class
when called from the following derived class:
Public Class DerivedClassThrowsExceptions<br />
Inherits BaseClassThrowsExceptions<br />
<br />
Public Shadows Sub MethodOne()<br />
Console.WriteLine("Derived class MethodOne calls base class MethodOne...")<br />
MyBase.MethodOne()<br />
End Sub<br />
<br />
Public Shadows Sub MethodTwo()<br />
Console.WriteLine("Derived class MethodTwo...")<br />
MyBase.MethodTwo()<br />
End Sub<br />
<br />
End Class
causes MethodTwo in the derived class to stop on an error when it calls the underlying method in the base class. If I put a Try...Catch block around it:
Public Class DerivedClassThrowsExceptions<br />
Inherits BaseClassThrowsExceptions<br />
<br />
Public Shadows Sub MethodOne()<br />
Console.WriteLine("Derived class MethodOne calls base class MethodOne...")<br />
MyBase.MethodOne()<br />
End Sub<br />
<br />
Public Shadows Sub MethodTwo()<br />
Console.WriteLine("Derived class MethodTwo...")<br />
Try<br />
MyBase.MethodTwo()<br />
Catch ex As Exception<br />
Console.WriteLine(ex.Message)<br />
End Try<br />
<br />
End Sub<br />
<br />
End Class<br />
then the exception is caught and displayed in the Catch region.
Is that what you're asking?
|
|
|
|
|
I'm developing an application, and one of it functions is to read files.
i want to add a progress bar which indicates how many precents of the file have been read.
the problem is that with big files the program hangs until the operation is completed, and no info is shown in the progress bar.
i'm working with j#.net but it can happen in any language.
here's a bit of the code:
public void readFile(String fileName)
{
FileStream fs =new FileStream(fileName,FileMode.Open);
long fileSize = fs.get_Length();
fs.Close();
StreamReader reader = new StreamReader(fileName);
progressWindow.Show(); //the form where the progress bar is.
int bytesRead = 0; //number of bytes that have been read.
char buf = '\0'; //buffer
while (reader.Peek() != -1) //while not at the end of the file...
{
buf = (char)(reader.Read());
/*...*/
bytesRead++;
//update the progress bar:
progressWindow.progressBar.set_Value((int)((bytesRead/fileSize)*100));
}
reader.Close();
writer.Close();
progressWindow.Hide();
}
thanks for your help.
|
|
|
|
|
You are using a synchronous I/O method, so the app hangs until the operation is compete. In order for your program to respond during these tasks use asynchronous I/O. Asynchronous I/O creates a separate thread to perform the I/O operation. See VS.NET documentation for details.
|
|
|
|
|
Hi!
Can you solve this problem?:
Do not loose SessionVariables when switching webapplications?
(I have a "FRAME" webapplication, which makes the authentication, menu,
and so on.
I wish to have more modules. These modules are optionally and i wont install all of them.
(possible way 1?)
I have my own SessionHandler wrapper, which can convert Requests into SessionVariables if it is neccessary. But, it seems to be a strange way. (not recommented, i think)
Problem:
i have more frames on clientside.
When i choose from menu (msiewebcontrols.TreeCtrl), i loose Session variables.
I fill up my menu from xml.(possible way?) so it is hard to encode runtime the xml.
so:
what about the same SessionHandleing in different webapplications?
AgyklonN
|
|
|
|
|
Hi all,
Normally the application config file name is app.config, but in my application have many application config file so I want to change it to xxxx_en.config or xxxx_fr.config for each module(DLL file), for each language
thanks,
cuong
|
|
|
|
|
|
Hi!
I created a "thin client" for a web service -- basically a simple C# Windows Form that connects to the web service and let the user interact with it.
Now I'd like to deploy that, but to make it easy for the client, I would prefer if they could simply download and execute the exec from a web page instead of having to install it using a Windows Installer (I used to create one using VS7 before).
Basically I'd like to have an ActiveX-like or Java applet-like deployment style for my windows form.
Does anybody think that is possible at all?
R/
|
|
|
|
|
|
Thanks, exactly what I needed!
I love MSDN, there's a lot of material there, yet I fear it because there's too much interesting stuff to read
|
|
|
|
|
Once upon a time (VS 6) I used to be able to copy a dialog resource from another project into my current project. As I get my feet wet with VS.NET 2002 I'm lost trying to figure out how to do it.
From what I gather, I can "Add Existing Item" from the project menu, but this ends up incorporating the whole RC file from my other project including any other dialogs, bmps, icons etc.
What I now have is a xyzDlg.cpp a xyzDlg.h and the dialog resource itself located in a .rc file. How on earth can I make a COPY of this dialog item so I can use it for my .NET app?
Note, I need to copy this resource not incorporate anything from the other project. I can't risk damaging the other VS6 project and it's (the other VS6.0 project) going to be archived off-line as soon as I have a copy so I don't somehow currupt it.
I feel awfully stupid, this should be easy. Help?
PAC
|
|
|
|
|
Under VS6, I simply used to open both RC files (the current project and the one to import from), then simply Control-C the dialog template and Control-V it into the new RC. Then copyied the .cpp/.h manually and inserted in the project manually.
I believe that may work with VS7 too but I haven't tried in a while.
|
|
|
|
|
Actually, it kind of works and it kind of doesn't.
I've been playing all day and have got the dialog resource in, but it's different.
With VC6 you could open the other rc file, hit copy then paste directly into the resource tab in class wizard.
With the new VC.NET all I've been able to figure out so far is open both old and new rc file in the editor and do a copy/paste.
The bad part is I still haven't been able to figure out how to link the cpp and h files with that dialog resource. If you run their wizard and tell it to use the old cpp and h files it just tacks on a new class at the bottom of each file resulting in two sets of implementations and declarations. <sigh>
Obviously there has to be a way to do it, but it sure is kicking my behind
PAC
|
|
|
|
|
Hi
We would like to know how many CPU resources a running
process is using.
The problem is that we would like to know the resource use
without the CPU resources used on associated I/O
operations.
Does any of you know of a performance counter that will
allow us to gather data about CPU resource use excluding
associated I/O operations?
Thanks for your help,
Mads Jensen
Mads Jensen
|
|
|
|
|
You could write your own preformance counter to count only the information that you need within your product.
|
|
|
|
|
I'm working on the basis for a CodeProject article, but stuck on a couple of issues. The current problem is as follows: I have to dynamically create a method that can be used as an event handler for a particular event, given only the EventInfo object that represents the event. This includes a reference to the type (subclassed from Delegate and accessed through the EventInfo.EventHandlerType property) that is created to represent the method in delegate form. However, there doesn't seem to be an obvious way to read out the desired method form (parameters & parameters' types, return type, etc.). Does anyone know how to get this method semi-signature out of the <vode>EventInfo, the event handler Type , or anything else that's dynamically accessible through the framework (almost certainly through Reflection)?
Thanks!
Eric Astor
|
|
|
|
|
This might get you on the right track:
Assembly assembly.LoadFrom("my_assembly.dll");
Type type=assembly.GetType("my_class");
MethodInfo mi=type.GetMethod("my_method");
Using MethodInfo, you can inspect the security, return type, parameters, etc. Lots of fun.
[edit]Oops--LoadFrom, not GetType[/edit]
Marc
Help! I'm an AI running around in someone's f*cked up universe simulator. Sensitivity and ethnic diversity means celebrating difference, not hiding from it. - Christian Graus Every line of code is a liability - Taka Muraoka Microsoft deliberately adds arbitrary layers of complexity to make it difficult to deliver Windows features on non-Windows platforms--Microsoft's "Halloween files"
|
|
|
|
|
I already understand this much of Reflection, but that doesn't help me... I need to dynamically create a method without ever actually seeing any method, only an EventInfo object or something that it publicly exposes a reference to.
|
|
|
|
|
I'm not really sure if this will help, but I use this to dynamically create a delegate:
public delegate object InterfacePoint(EventData eventData);
...
void RegisterInterfacePointByReflection(object instance, string fncName)
{
Type ipType=typeof(InterfacePoint);
InterfacePoint ip=null;
ip=Delegate.CreateDelegate(ipType, instance, fncName) as InterfacePoint;
}
You have to have an instance of the object containing the event sink though. If you don't have an instance, you have to pass CreateDelegate a MethodInfo instead.
Is THIS anything closer to what you need? If not, can you give me an example of what you have and where you want to go with it? (Gee, that sounds a lot like a Microsoft tag line).
Marc
Help! I'm an AI running around in someone's f*cked up universe simulator. Sensitivity and ethnic diversity means celebrating difference, not hiding from it. - Christian Graus Every line of code is a liability - Taka Muraoka Microsoft deliberately adds arbitrary layers of complexity to make it difficult to deliver Windows features on non-Windows platforms--Microsoft's "Halloween files"
|
|
|
|
|
Alright... What I'm working on involves the dynamic creation of a wrapper class (through use of the Emit namespace) around a provided class that I see only as its Type object representation. As part of building the wrapper class, I need to emit methods for each event of the original class such that each method fits the requirements to be used in the delegate type used for the targeted event. Unfortunately, I can't seem to find any way to pull out anything that I could use to dynamically discover the required method signature for the creation of a method that can be used in the initialization of a provided delegate. The primary thing available to me with respect to the event is the EventInfo object, but the only thing that that exposes as to the event handler required for it is the Type object representing the class that inherits the System.Delegate class. This is a Type object like any other, and I can't find any way to pull the method signature out of it that it wants for its instantiation.
|
|
|
|