Converting from vb.net to c#.net

Hello

I have recently purchased VBGolds RawDataPrinter which should allow users to print directly to label printers on our network directly from a c# web form.  Unfortunately they only supply vb.net examples and I have need of c#.  The component has been installed on our web server.  This is some code that they have supplied as examples in vb.net

 

"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
"Head1" runat="server">  
    "text-align: center">       
        "Label1" runat="server" Style="font-weight: bold; font-size: 10pt;
            color: white; font-family: Tahoma; background-color: brown" Text="Raw Data Printer - Client-Side Printing Demo"
            Width="352px">    

<object id="Printer"
classid="CLSID:402C09CD-68ED-48B0-B008-E7B01DDBD2D5"
codebase="RawDataPrinter.CAB#version=2,0,0,0">
object>
    "form1" runat="server">   
   
        "font-size: 10pt; font-family: Tahoma">"font-size: 0.8em">If Raw Data Printer was installed properly, the following text area should automatically
            be filled with a list
        of all detected
        client printers. This is done using client-side
            VB Script that calls the GetPrinters method of the object.
       
       
        "text1"</span> style=<span class='st'>"width: 456px; height: 112px; font-size: 8pt; font-family: Tahoma;"</span> onclick=<span class='st'>"return text1_onclick()"</span>>
           
            --------------------------------------------------------------------------------
            "HiddenField1" runat="server">           
            "font-size: 8pt">Click this button to send the list of detected client printers
                to the server, where they will be stored in a session variable so that they can
                be used later on to print to a specific client printer, whose name is specified
                from the server-side code.           
       
       
        "Button1" runat="server" Text="Post Printers List to The Server" Width="304px" style="font-size: 8pt; font-family: Tahoma">
       
        "lblPrinters" runat="server" Height="112px" Style="font-size: 8pt;
            font-family: Tahoma" Width="464px">
       
        "Button2" runat="server" Style="font-size: 8pt; font-family: Tahoma"
            Text="Return to Main Page" Width="304px">

    And the code behind
Partial Class GetClientPrinters    Inherits System.Web.UI.Page


    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Store the client printers list in a session variable
        Session("ClientPrinters") = HiddenField1.Value
        'Show them back on the client
        lblPrinters.Text = "The following list of client printers are now stored in a session variable on the server: <br>" & Replace(Session("ClientPrinters"), "|", "<br>")
    End Sub

 

    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        Response.Redirect("Default.aspx", True)
    End Sub

 

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Session("ClientPrinters") <> "" Then
            lblPrinters.Text = "The following list of client printers are stored in a session variable on the server: <br>" & Replace(Session("ClientPrinters"), "|", "<br>")
        End If
    End Sub
End Class

 

 

Could anyone help please

 


No man is an island.....Except barry
0
welshpunk
8/12/2008 6:40:01 AM
asp.net.getting-started 91979 articles. 3 followers. Follow

6 Replies
1555 Views

Similar Articles

[PageSpeed] 19

http://labs.developerfusion.co.uk/convert/vb-to-csharp.aspx you can use this to convert the code to C#


Don't forget to click "Mark as Answer" on the post that helped you.
0
tompy_nation
8/12/2008 7:27:21 AM

 You can use any online converter and just put this vb code into the text area and click on convert to C# thats it. or watch out the following few lines.

Partial Class GetClientPrinters :  System.Web.UI.Page

{

    protected void Sub Button1_Click(object sender, EventArgs e)
    {     

        //Store the client printers list in a session variable
        Session["ClientPrinters"] = HiddenField1.Value;
        //Show them back on the client
        lblPrinters.Text = "The following list of client printers are now stored in a session variable on the server: <br>" + Strings.Replace(Session("ClientPrinters"), "|", "<br>");
    }

    protected void Sub Button2_Click(object sender, EventArgs e)
    {  

          Response.Redirect("Default.aspx", true);

    }

    protected void Page_Load(object sender, System.EventArgs e)
    {
       if (Session("ClientPrinters") != "") {
         lblPrinters.Text = "The following list of client printers are stored in a session variable on the server: <br>" + Strings.Replace(Session("ClientPrinters"), "|", "<br>");
    
    } 

 }


ROAMER!

if (myReply.Equals(YourAnswer))
{
MarkThisThread = "Answerd";
}
0
ROAMER
8/12/2008 8:05:07 AM

Does anyone know how to create an instance of an object in c# the alternative of this

Dim RDP As New RawDataPrinter.Printer

Regards Phill


No man is an island.....Except barry
0
welshpunk
8/12/2008 12:27:44 PM


{
    RawDataPrinter.Printer RDP = new RawDataPrinter.Printer();
}

This gets me errors

Error 1 The type or namespace name 'RawDataPrinter' could not be found (are you missing a using directive or an assembly reference?) 

I have added the dll to my bin folder


No man is an island.....Except barry
0
welshpunk
8/12/2008 12:42:23 PM

I'm guessing you've put the dll in the bin folder, but haven't put a

#using yourNamespace at the top of the file.

In VB.Net you do this with the Imports directive. In c# it's like:

#using System;

#using System.Data;

#using YourLibrary;

etc....

0
HeartattacK
8/12/2008 1:25:44 PM
Reply:

Similar Artilces:

Sending SMS using vb.net or C#.net using vb.net or c#.net
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

converting to vb.net from c#.net authorize.net
authorize.net offered me some sample code when I signed up with them the only problem is the sample code is in c#.net but my page that they type all of their credit card into is vb.net <code><%@ Import Namespace="System.Net" %> <%@ Import Namespace="System.IO" %> <script language="C#" runat="server"> void Page_Load(Object Src, EventArgs E) { myPage.Text = readHtmlPage("https://certification.authorize.net/gateway/transact.dll"); } private String readHtmlPage(string url) { ...

use VB.NET and C#.NET code in the same C#.NET project
All-- Here is a sample that is "off the beaten path", (at least for me). Is it possible, in an ASP.NET application, using the code-behind page building technique, to have both pages written in VB.NET and pages written C#.NET?At http://www.WebLogicArts.com/DemoList.aspx there is a sample that shows that, (contrary to popular belief), it IS possible to mix ASP.NET pages built with C#.NET with ASP.NET pages built with VB.NET in the same VS.NET 2003 project. Note that this is just a "fun" sample to see if it can be done and I do not recommend this practice as a "standard" way of develo...

used a c#.net to vb.net converter and am now getting a syntax error.
ok I used a cool utility at http://www.kamalpatel.net/ConvertCSharp2VB.aspx to convert some c#.net to vb.net and it spit out a bunch of code which almost works but I am getting a syntax error on this line Imports (StreamReader sr = Shadows Function)() As StreamReader(objResponse.GetResponseStream()) I tried it that way and also like Imports (StreamReader sr = Shadows Function)() As StreamReader(objResponse.GetResponseStream()) but either way gave the same error Compiler Error Message: BC30035: Syntax error. Source Error: Line 26: Line ...

convert c#.net page to vb.net
ok I have an entire page in vb.net and now I want to integrate some code from another page but it written in c#.net what is the easiest way to convert c#.net to vb.net I tried using www.kamalpatel.net/ConvertCSharp2VB.aspx but it only gave me errors here is what I am trying to convert let me know if you have any ideas http://www.nomorepasting.com/paste.php?pasteID=20953 With Alex Lowe's translator ' Messages Private NoFileMessage As String = "No file selected" Private UploadSuccessMessage As String = "Uploaded Sucess" Private NoImagesMessag...

Convert VB.Net application to C#.net
Haican any one help me to convert VB.Net application in this link to C#.net http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=6718&lngWId=10RegardsAnu Palavila  Regards Anu Palavila Use this Free Conversion tool - http://www.developerfusion.com/tools/convert/vb-to-csharp/  ASP.NET Grid With Excel Capabilities | 27 GridView Tips & Tricks | Hosting your site? | SQL Server Tips Other Code Convertors (convert VB to C# and C# to VB) http://converter.telerik.com/ http://www.developerfusion.com/tools/convert/csharp-to-vb/ http://www.dotnetspider.com...

vb.net vs c#.net vs j#.net
just out of curiousity which looks, acts most like java? i'm still learning trying to used to vb.net but it seems that it was easier to do some stuff with java. C# is Java++ in my opinion. If you have done C or Jave you will prefer C#.Mike Schellenberger - MCAD If you are looking for language similar to java go for J#. However most code samples you find on the net will be in VB.NET and C#....

vb .net or c# .net
I currently develop websites using php but have been requested to develop a site using asp.net. The question I have is for someone who knows php would it be better to transition to vb.net or c#.net? Thanks, Fr. Robert C# -> There is a converter that will transition about 60% or more of your PHP code to C#. Plus C# is closer to PHP than VB.NET.Jason N. GaylordASPInsider and Microsoft MVPhttp://jasongaylord.com...

C#.NET or VB.NET
what lang does everyone prefer? Thanks, Peter Iuvara, MCP It's a very famous debatable question in forums! I would say if you are from Java/C/C++, then C# would be easy to use for you. If you are from ASP/VB, then VB.NET would be easy for you! As long as if you follow CLS, then what ever the language you use, it's going to be the same for CLR!Sreedharhttp://www.w3coder.orgweblog http://weblogs.asp.net/skoganti I would agree with that ... just curious as to what user's on this forum predominantly code in?Thanks, Peter Iuvara, MCP I came from no real programming background, started i...

VB.Net To C#.Net
Hello... Since Last from 1 year i had develope web application in using vb.net now i want to transfer from vb.net to c#.net so what should i do to transform to c# language any link or book related to me through i can easily understand and coding using c# in a short time... Thanks~ Mark As Answer If UseFull ~Kaushal. Hi, you can read the specifications of the language. You're already familiar with .NET and how to program in an OO manner thanks to your experience with vb.net. The only thing you need to learn is the new syntax of C#. You can also convert parts of your v...

online sites to convert C#.Net to VB.Net
what are the best sites to convert C#.Net code to VB.Net code? I have to convert .net 2005 code from one to the other. just wondering what your experiences have been. thanks much I am a big fan of developer fusion's converters. I think they work reasonably well. They are quick and get the job done, and it is quick and easy to go either way. VB to C# or C# to VB.http://labs.developerfusion.co.uk/convert/vb-to-csharp.aspxhttp://labs.developerfusion.co.uk/convert/csharp-to-vb.aspxJust my recommendation. I am sure you'll hear a few different responses.Brendan C. Brendan EnrickBr...

How to convert C#.Net code to VB.Net code ???...
HI, i was searching something new, then i suddenly find some tips to convert C#.Net code to VB.Net but i did not do well. i am puttint its url here plz tell me how to convert C#.Net code to VB.Net. http://www.dotnetspider.com/code/C-273-Convert-C-VB-NET.aspx Jasim...Please remember to click “Mark as Answer” on the post that helps youJasim AkhtarNew Delhi ( INDIA ) It would be better if you write the problem you having, while converting from C# to VB.NET. You cannot completely rely on online converters. ThanksMark post(s) as "Answer" that helped youElectronic ScrewWebsite||Bl...

Regarding Converting DataSet to PDF format in C#.Net/VB.Net
Hi, I can anyone help me regarding conversion of an dataset to PDF format. Thank YouMark as Answer if it helped youGayathri gayathri.pmsc: Hi, I can anyone help me regarding conversion of an dataset to PDF format. Thank You Either do it using Crystal Reports or create an html ny looping though dataset and then to pdf using itextsharp http://hamang.net/2008/08/14/html-to-pdf-in-net/MAKMark as Answer if this reply helps youMVP ASP/ASP.NetASP.Net Hosting : Host DepotMy Site : ASPSnippets...

vb.net and c#.net same app
Been asked before, but... If I build a c# web app and someone builds a vb.net desktop app, can they communicate? and can you develop against it...ie..in my c# web app, can I add the vb.net desktop app as a reference? or at least make calls to it? web apps or desktop apps can contain components created in either language. i have a web solution that contains 4 projects. One of the projects is C# the others are VB.Mike Banavige~~~~~~~~~~~~Need a site code sample in a different language? Try converting it with: http://converter.telerik.com/ Thanks...that is what I was looking for ...

Web resources about - Converting from vb.net to c#.net - asp.net.getting-started

Facebook Begins Converting Users To HTTPS
Are you willing to sacrifice a little bit of speed for a lot more safety? Facebook is asking that very question with its announcement that it ...

Facebook No Longer Converting Groups Into Pages
Back when Facebook first launched Facebook Pages, many businesses and brands who had built up substantial audiences in their Facebook Groups ...

Vert - simply converting for iPhone, iPad, and iPod touch on the iTunes App Store
Get Vert - simply converting on the App Store. See screenshots and ratings, and read customer reviews.

Converting SIM Card to Micro SIM Card - Flickr - Photo Sharing!
Place new Micro SIM into the iPhone SIM card tray

Ayaan Hirsi Ali on Converting Muslims to Christianity - YouTube
Complete video at: http://fora.tv/2010/07/29/Nomad_From_Islam_to_America_with_Ayaan_Hirsi_Ali Ayaan Hirsi Ali explains her support of missionary ...

Click go fears of converting print files
Is there a way to convert a print queue item to a .RTF or .PDF file? I like to save or email them. - The Sydney Morning Herald

Sudanese woman ordered to hang under sharia law for converting to Christianity gives birth
Khartoum, Sudan: A Christian Sudanese woman sentenced to hang for apostasy has given birth in jail, a Western diplomat said on Tuesday.

Imams warn against radicalism to Aboriginal inmates converting to Islam
The prison system has enlisted the help of ASIO to crack down on radicalisation behind bars amid revelations that Aboriginals are converting ...

Converting the world's companies one by one - The Science Show - ABC Radio National (Australian Broadcasting ...
Image: Trucks carrying logs make their way up a road in Jambi, Indonesia. A vast area of the Sumatran forest, and orangutan habitat, is being ...

Converting Churches Into Homes Is The Latest Hollywood Trend
You don't have to be a believer to be moved by the beauty of a church.

Resources last updated: 12/10/2015 12:22:54 AM