N
nique
Hello,
I am trying to convert a simple application I have
written, first in vb6 then to vb.net and now I would like
to convert it to c#.
The part that I am having problems with in c# is
referencing the objects.
I keep getting the error "Can not implicitly
convert 'object' to(whatever object i'm trying to set it
at)"
I have added the com reference in my c# project and when I
am declaring objects, seems to be 'okay' before runtime.
The part of the vb.net code I would like to convert to c#
is:
Public Class Form1
Dim objApplication As COMMNAME.Application
Dim objCurrentScreen As COMNAME.COMNAMEScreen
Dim objSession As COMNAME.COMNAMESESSION
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
objApplication = CreateObject("COMMNAME.Application")
objSession = objApplication.ACTIVESESSION
objCurrentScreen = objSession.Screen
End sub
End Class
This part of the code was written originally in vb6, and
works fine in vb.net.
What is the equivalent version of this code in c#(without
the button1_click part)?
I have tried the following code:
COMMNAME.Application objApplication;
COMNAME.COMNAMESESSION objSession;
COMNAME.COMNAMEScreen objCurrentScreen =
objApplication = COMMNAME.Application;
objSession = objApplication.COMNAMESESSION;
objCurrentScreen = objSession.SCREEN;
And I get that error:"Can not implicitly convert 'object'
to'.
Anyone's help will be greatly appreciated.
Thanks!
I am trying to convert a simple application I have
written, first in vb6 then to vb.net and now I would like
to convert it to c#.
The part that I am having problems with in c# is
referencing the objects.
I keep getting the error "Can not implicitly
convert 'object' to(whatever object i'm trying to set it
at)"
I have added the com reference in my c# project and when I
am declaring objects, seems to be 'okay' before runtime.
The part of the vb.net code I would like to convert to c#
is:
Public Class Form1
Dim objApplication As COMMNAME.Application
Dim objCurrentScreen As COMNAME.COMNAMEScreen
Dim objSession As COMNAME.COMNAMESESSION
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
objApplication = CreateObject("COMMNAME.Application")
objSession = objApplication.ACTIVESESSION
objCurrentScreen = objSession.Screen
End sub
End Class
This part of the code was written originally in vb6, and
works fine in vb.net.
What is the equivalent version of this code in c#(without
the button1_click part)?
I have tried the following code:
COMMNAME.Application objApplication;
COMNAME.COMNAMESESSION objSession;
COMNAME.COMNAMEScreen objCurrentScreen =
objApplication = COMMNAME.Application;
objSession = objApplication.COMNAMESESSION;
objCurrentScreen = objSession.SCREEN;
And I get that error:"Can not implicitly convert 'object'
to'.
Anyone's help will be greatly appreciated.
Thanks!