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