473,396 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to convert vb codes to c# codes in Asp.net????

Hello all,

I need to convert this following vb.net codes to c# codes within a day or two.
So i need this help urgently.
Please look at the following code and help me out to finish this barcode generation task in a short period...

Sub BarCode(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Input As String = Request.Querystring.ToString()
Dim Digit, i As Integer
Dim ValidInput As String = "0123456789"
For i = 1 to Input.Length
If Instr(1, ValidInput, Mid(Input, i, 1)) = 0 Then
Response.Write("Invalid input")
Response.End
End If
Next
ValidInput += Chr(0) & Chr(255)
Dim ValidCodes As String = "277834142902349827743434292227423418290602180 214"
Input = Chr(0) & Input & Chr(255)
Dim bmp As Bitmap = New Bitmap((Input.Length * 12), 50)
Dim g As Graphics = Graphics.FromImage(bmp)
g.FillRectangle(New SolidBrush(Color.White), 0, 0, (Input.Length * 12), 50)
Dim p As New Pen(Color.Black, 1)
Dim BarValue, BarX As Integer
Dim BarSlice As Short
For i = 1 To Input.Length
BarValue = Val(Mid(ValidCodes, ((InStr(1, ValidInput, Mid(Input, i, 1)) - 1) * 4) + 1, 4))
Digit = 12
If i=1 Or i = Input.Length Then Digit = 8
For BarSlice = Digit To 1 Step -1
If BarValue >= 2 ^ BarSlice Then
g.DrawLine(p, BarX, 0, BarX, 50)
BarValue = BarValue - (2 ^ BarSlice)
End If
BarX += 1
Next
Next
Response.ContentType = "image/gif"
bmp.Save(Response.OutputStream, ImageFormat.GIF)
g.Dispose()
bmp.Dispose()
End Sub


Thanks in advance
Nov 2 '06 #1
0 1148

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Lamberti Fabrizio | last post by:
Hi all. I've got an ActiveX Object that gives me OleColor codes for its graphical components. I need to convert these OleColor codes into RGB codes using JScript or VBScript, becuase I have...
1
by: rob.kellington at gmail | last post by:
Does anyone have the logic to convert RTF formatted data in a text column into plain ascii text that I can use in a varchar variable or field? We have an app that allows formatted comments/notes...
11
by: Kai Bohli | last post by:
Hi all ! I need to translate a string to Ascii and return a string again. The code below dosen't work for Ascii (Superset) codes above 127. Any help are greatly appreciated. protected...
2
by: ABC | last post by:
I have a very large amount VB code convert into C Sharp. I just complete it use tools. But it still have some codes errors. There are object to datatype problems. I need to edit many files to...
25
by: Charles Law | last post by:
I thought this was going to be straight forward, given the wealth of conversion functions in .NET, but it is proving more convoluted than imagined. Given the following <code> Dim ba(1) As...
3
by: Jonathan | last post by:
Hi I want to convert HTML codes ("!" , "#" , "$" , "%") to text ("!","#", "$", "%"). How can i do it without replacing one an one the codes? Thanks in advance
0
by: setheo | last post by:
To all gurus, I am currently converting some of C++ codes to VB.net The C++ Codes is as follows : ================= C++ CODE ================== typedef struct _tagBBCameraParameter {...
2
by: Poppy | last post by:
I'm reading from a database a column that has a list of codes (comma seperated). When I read in the list I have a single value, see code sample below values for a, b, and c. These represent...
4
by: Peter | last post by:
Does anyone know how to convert the following VB6 code to C# code? Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (dest As Any, Source As Any, ByVal bytes As Long) Dim...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.