473,569 Members | 2,611 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using vb control

I have been given a tiny little vb control that I would like to use in my c#
application. I don't want to make an independant .dll out of it because
it's so small. Can anyone tell me how I can include it in my visual studio
..net project and have it properly compiled as VB ?
Nov 16 '05 #1
16 1395
Hi Mike,

Based on my understanding, you want to use your VB control in .Net project.

I think your Vb control is an Active X control, which is also a COM
component. In .Net, you can use COM through COM interop.

In VS.net, you can just use "Add Reference" to browse to the VB control and
add it into. Then VS.net will automatically add a .Net class wrapper for
your COM component.

Then you can use it like .Net class. For more detail information and class
information about your wrapped VB control, you can see its reference in
"Object Browser"

=============== =============== ====
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #2
I guess I didn't describe my problem very well. I have been given two
files, one that is is a .vb file which implements user control, written in
VB.NET and the other is the complementory .resx file. I would like to
compile these into my c# project, but within that project the compiler
doesn't seem to recognize VB. How can I successfully add these files into
my otherwise c# project and get the compiler to know what to do. I'm rather
suprized it's not completely automatic.
""Jeffrey Tan[MSFT]"" <v-*****@online.mi crosoft.com> wrote in message
news:Yo******** *****@cpmsftngx a10.phx.gbl...
Hi Mike,

Based on my understanding, you want to use your VB control in .Net project.
I think your Vb control is an Active X control, which is also a COM
component. In .Net, you can use COM through COM interop.

In VS.net, you can just use "Add Reference" to browse to the VB control and add it into. Then VS.net will automatically add a .Net class wrapper for
your COM component.

Then you can use it like .Net class. For more detail information and class
information about your wrapped VB control, you can see its reference in
"Object Browser"

=============== =============== ====
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #3
Hi Mike,

Thanks very much for your feedback.

Oh, based on your feedback, I see that what you have is a VB.net
usercontrol's source file. You want to use it in a C# project.

For a C# project, it will use csc.exe compiler to compile it and generate
assembly. It can not recognize VB.net code.

You should add a new VB.net windows control project into your entire
Solution, then add the VB.net usercontrol source code into this project.
Then, you can compile this project, an assembly will generate for this
VB.net usercontrol source code.

At last, you may add this usercontrol assembly into C# project through Add
Reference or through Tool Box

=============== =============== =====
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #4
I guess what I'm hearing is that with .NET it is not possible to mix c# code
with vb code in a single .dll.

""Jeffrey Tan[MSFT]"" <v-*****@online.mi crosoft.com> wrote in message
news:r9******** *****@cpmsftngx a10.phx.gbl...
Hi Mike,

Thanks very much for your feedback.

Oh, based on your feedback, I see that what you have is a VB.net
usercontrol's source file. You want to use it in a C# project.

For a C# project, it will use csc.exe compiler to compile it and generate
assembly. It can not recognize VB.net code.

You should add a new VB.net windows control project into your entire
Solution, then add the VB.net usercontrol source code into this project.
Then, you can compile this project, an assembly will generate for this
VB.net usercontrol source code.

At last, you may add this usercontrol assembly into C# project through Add
Reference or through Tool Box

=============== =============== =====
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #5
Mike Oliszewski <mi***@faxback. com> wrote:
I guess what I'm hearing is that with .NET it is not possible to mix c# code
with vb code in a single .dll.


Yes it is - just not from VS.NET. From the command line, you can
compile to .netmodule files, and then use the assembly linker to link
those together into a single assembly.

It's rarely worth the hassle though.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #6
Allright Jon! Is there any way you could give us the
exact method of actually doing this? I have tried so
many different ways to do this, it isn't even funny
anymore. Someone else told me this was possible,
but I suspect he had not actually tried it. Please, if
it can really be done, post an example of the series
of commands so that I can really do it for myself.

I have resorted to decompiling to IL, then merging
the resulting code from the VB and C# into one IL
file, then compiling that with ILASM to make one
assembly. Please, PLEASE do not just quote the docs
on this, I want to know that someone has done it
and that everything works as it is supposed to.

I'm serious, I am now wondering if this is really
possible. I'm talking about making ONE executable
assembly, not just linking to an existing netmodule.
For the life of me, I cannot get this to work.
One assembly that does NOT require any other files
or modules or assemblies to be present. Can it be
done?

Thanks.

"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
Mike Oliszewski <mi***@faxback. com> wrote:
I guess what I'm hearing is that with .NET it is not possible to mix c# code with vb code in a single .dll.


Yes it is - just not from VS.NET. From the command line, you can
compile to .netmodule files, and then use the assembly linker to link
those together into a single assembly.

It's rarely worth the hassle though.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Nov 16 '05 #7
Allright Jon! Is there any way you could give us the
exact method of actually doing this? I have tried so
many different ways to do this, it isn't even funny
anymore. Someone else told me this was possible,
but I suspect he had not actually tried it. Please, if
it can really be done, post an example of the series
of commands so that I can really do it for myself.

I have resorted to decompiling to IL, then merging
the resulting code from the VB and C# into one IL
file, then compiling that with ILASM to make one
assembly. Please, PLEASE do not just quote the docs
on this, I want to know that someone has done it
and that everything works as it is supposed to.

I'm serious, I am now wondering if this is really
possible. I'm talking about making ONE executable
assembly, not just linking to an existing netmodule.
For the life of me, I cannot get this to work.
One assembly that does NOT require any other files
or modules or assemblies to be present. Can it be
done?

Thanks.

"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
Mike Oliszewski <mi***@faxback. com> wrote:
I guess what I'm hearing is that with .NET it is not possible to mix c# code with vb code in a single .dll.


Yes it is - just not from VS.NET. From the command line, you can
compile to .netmodule files, and then use the assembly linker to link
those together into a single assembly.

It's rarely worth the hassle though.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Nov 16 '05 #8
Allright Jon! Is there any way you could give us the
exact method of actually doing this? I have tried so
many different ways to do this, it isn't even funny
anymore. Someone else told me this was possible,
but I suspect he had not actually tried it. Please, if
it can really be done, post an example of the series
of commands so that I can really do it for myself.

I have resorted to decompiling to IL, then merging
the resulting code from the VB and C# into one IL
file, then compiling that with ILASM to make one
assembly. Please, PLEASE do not just quote the docs
on this, I want to know that someone has done it
and that everything works as it is supposed to.

I'm serious, I am now wondering if this is really
possible. I'm talking about making ONE executable
assembly, not just linking to an existing netmodule.
For the life of me, I cannot get this to work.
One assembly that does NOT require any other files
or modules or assemblies to be present. Can it be
done?

Thanks.

"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
Mike Oliszewski <mi***@faxback. com> wrote:
I guess what I'm hearing is that with .NET it is not possible to mix c# code with vb code in a single .dll.


Yes it is - just not from VS.NET. From the command line, you can
compile to .netmodule files, and then use the assembly linker to link
those together into a single assembly.

It's rarely worth the hassle though.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Nov 16 '05 #9
Allright Jon! Is there any way you could give us the
exact method of actually doing this? I have tried so
many different ways to do this, it isn't even funny
anymore. Someone else told me this was possible,
but I suspect he had not actually tried it. Please, if
it can really be done, post an example of the series
of commands so that I can really do it for myself.

I have resorted to decompiling to IL, then merging
the resulting code from the VB and C# into one IL
file, then compiling that with ILASM to make one
assembly. Please, PLEASE do not just quote the docs
on this, I want to know that someone has done it
and that everything works as it is supposed to.

I'll be watching...

Thanks.

"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
Mike Oliszewski <mi***@faxback. com> wrote:
I guess what I'm hearing is that with .NET it is not possible to mix c# code with vb code in a single .dll.


Yes it is - just not from VS.NET. From the command line, you can
compile to .netmodule files, and then use the assembly linker to link
those together into a single assembly.

It's rarely worth the hassle though.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
3061
by: Colin McGuire | last post by:
Hi, I have an report in Microsoft Access and it displays everything in the table. One column called "DECISION" in the table has either 1,2, or 3 in it. On my report it displays 1, 2, or 3. I want to appear in the report is Yes, No, or Maybe. What do I need to do to change what appears in the report/what term do I need to search out in Google?...
8
2732
by: sara | last post by:
I am learning Access and programming. I wanted to have the user select the departments for an ad from the list of all departments. Found code (that I could understand) on this site, and it works. But I have 2 quesitons: 1. How can I REMOVE a selection from the Destination List box - and keep the others there? My first code removes ALL...
9
3943
by: Guy | last post by:
I have extended the datetimepicker control to incorporate a ReadOnly property. I have used the new keyword to implement my own version of the value property, so that if readonly == true then it will not set the value of the control and will leave the checked status of the checkbox to false when a user selects a new date. this works fine...
0
3464
by: Jim dunn | last post by:
HI I am having problems with C# with regards to its compatibility with win32 API methods, I am trying to read from a windows CE comm port using C# and imported methods from coredll.dll, it seems that I can set the comm state however when I try and read from the port using ReadFile method I cannot, I've tried to change the DCB object flag...
5
3146
by: Marcel Gelijk | last post by:
Hi, I am trying to create a User Control that is located in a seperate class library. The User Control contains a textbox and a button. The page generates an exception when it tries to access the code variable that are supposed to be linked to the contained controls. It runs fines when everything is contained in a single web form project....
3
1494
by: msnews.microsoft.com | last post by:
Hello All, I am trying to write Web Controls and in most of the samples I came across, I am seeing the following function where a HTML string is written to create HTML Controls. /// <summary> /// Render this control to the output parameter specified.
15
4733
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update button will verify the information that has been entered and updates the data base if the data is correct. Update will throw an exception if the data is...
4
6894
by: Dave Calkins | last post by:
I have a native Win32 C++ app built with Visual Studio 2005. I'd like to make use of a property grid control in this app. For an example of this, in Visual Studio, see the properties control (select something in a dialog from the dialog editor or a class from the class list and hit F4). I used Spy++, which revealed that the window class of...
53
4638
by: Hexman | last post by:
Hello All, I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm using some VB6 code, .Net2003 code, and .Net2005 code. I'm developing in vb.net 2005. This test sub just reads an input text file, writing out records to another text file, eliminating...
6
1869
by: tshad | last post by:
I was looking at a page that showed how to set up a custom event and it seems to work ok. But I am not sure how I would use it. How would I subscribe to it. There is actual action (such as pressing a button or changing text in a textbox). It gets set up and on the user control on my web page I can see the event from intellisense. So it...
0
7614
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8125
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7974
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.