且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

需要帮助使用C#应用程序输出到vb.net应用程序

更新时间:2023-02-08 11:01:01

您可以将生成条形码的C#代码转换为DLL。从VB.NET应用程序调用条形码生成器是一件简单的事情。或者只是在VB.NET中重写它。


请查看一些文章。

1. 我们如何使用Vb.Net创建条形码生成器。 [ ^ ]。

2. 快速而肮脏的条形码图像httpHandler [ ^ ]。

3. VB.NET Code 128 Generator [ ^ ]。

4. Code 128条码控制/ DLL for VB。 NET [ ^ ]。

5. VB.NET条形码生成指南 [ ^ ]


假设您在C#app中有图像,并且想要传输图像到VB.NET应用程序,放在PictureBox1。

如果两个应用程序在同一台计算机上运行,​​你可以使用剪贴板。



VB代码.NET应用程序:

 私有  Sub  ReceiveImage( ByVal  state  As   Object 
Dim hWait 作为 系统.Threading.EventWaitHandle( False ,System.Threading.EventResetMode.ManualReset, Global \ ImageTransfer
执行
hWait.WaitOne()' 来自C#应用程序的等待信号
.Invoke(系统.Threading.ThreadStart( AddressOf GetImageFromClipboard))
hWait.Reset()
循环
结束 Sub

私有 Sub GetImageFromClipboard()
PictureBox1.Image = Clipboard.GetImage()
结束 Sub



在表格加​​载事件中添加此行:

 System.Threading.ThreadPool.QueueUserWorkItem( New  System.Threading.WaitCallback( AddressOf  ReceiveImage)) 





从C#app发送图片:

图片anImage; 

Clipboard.SetImage(anImage);
// 告诉你的VB.NET应用程序,剪贴板中有一个图像
System.Threading.EventWaitHandle.OpenExisting( Global \\ImageTransfer)。Set() ;


Hi all

I have one application for barcode generation in c# and my actual application is in vb.net.
Now in the C# application there is one button called encode. after clicking that it shows the generated bar code for a particular string.

Now i want that final barcode image to be placed (e.g.in a picturebox)in my vb.net application form..means the output of the C# application.



Is it possible to do..???

else please tell me some solution for that

Thank you

You could convert the C# code that generates the barcode into a DLL. It is then a simple matter to call the barcode generator from your VB.NET application. Alternatively just rewrite it in VB.NET.


Please check some articles.
1. How we can Create Bar Code Generator Using Vb.Net.[^].
2. A Quick and Dirty Bar Code Image httpHandler[^].
3. VB.NET Code 128 Generator[^].
4. Code 128 Barcode Control / DLL for VB.NET[^].
5. VB.NET Barcode Generation Guide[^]


Suppose that you have an image in C# app, and you want to transfer the image to VB.NET app, placed in PictureBox1.
If both applications runs in same computer, you can use Clipboard.

Code for VB.NET app:
Private Sub ReceiveImage(ByVal state As Object)
    Dim hWait As New System.Threading.EventWaitHandle(False, System.Threading.EventResetMode.ManualReset, "Global\ImageTransfer")
    Do
        hWait.WaitOne() ' Waiting signal from your C# app
        Me.Invoke(New System.Threading.ThreadStart(AddressOf GetImageFromClipboard))
        hWait.Reset()
    Loop
End Sub

Private Sub GetImageFromClipboard()
    PictureBox1.Image = Clipboard.GetImage()
End Sub


add this line in Form Load event:

System.Threading.ThreadPool.QueueUserWorkItem(New System.Threading.WaitCallback(AddressOf ReceiveImage))



To send an Image from C# app:

Image anImage;

Clipboard.SetImage(anImage);
// Tell your VB.NET app, there is an image in Clipboard
System.Threading.EventWaitHandle.OpenExisting("Global\\ImageTransfer").Set();