The project worked in Vb language and Iwant to convert to C# language
Excuse me helped when the project is delivered within two days
Imports System.Data
Imports System.Data.OleDb
Imports System.Web.Configuration
Partial Class _Default
Inherits System.Web.UI.Page
Dim Con As New Data.OleDb.OleDbConnection(Web.Configuration.WebConfigurationManager.ConnectionStrings("MyConnectionString").ConnectionString)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim cmd2 As New OleDbCommand("select Q,a1,a2,a3,a4 from ope", Con)
Con.Open()
Dim dr As OleDbDataReader = cmd2.ExecuteReader
If dr.Read Then
label2.Text = dr(0)
RadioButton1.Text = dr(1)
RadioButton2.Text = dr(2)
RadioButton3.Text = dr(3)
RadioButton4.Text = dr(4)
End If
dr.Close()
Con.Close()
End Sub
Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click
If RadioButton1.Checked = False AndAlso RadioButton2.Checked = _
False AndAlso RadioButton3.Checked = False AndAlso RadioButton4.Checked = False Then
Exit Sub
End If
'Try
' If Request.Cookies("vv").Value = "t" Then
' Label3.Visible = True
' Exit Sub
' End If
'Catch ex As Exception
'End Try
Dim x, y(3) As Byte
If RadioButton1.Checked Then x = 0 : GoTo x
If RadioButton2.Checked Then x = 1 : GoTo x
If RadioButton3.Checked Then x = 2 : GoTo x
If RadioButton4.Checked Then x = 3
x:
Dim cmd As New OleDbCommand("select r1,r2,r3,r4 from ope", Con)
Con.Open()
Dim dr As OleDbDataReader = cmd.ExecuteReader
If dr.Read Then
y(0) = dr.Item(0)
y(1) = dr.Item(1)
y(2) = dr.Item(2)
y(3) = dr.Item(3)
End If
dr.Close()
Con.Close()
y(x) += 1
Dim cmd2 As New OleDbCommand("update ope set r" & CStr(x + 1) & " = " & CStr(y(x)), Con)
Dim updated As Integer
Con.Open()
updated = cmd2.ExecuteNonQuery()
Con.Close()
Panel1.Visible = False
Panelxxx.Visible = True
'==================================================
'==================================================
Dim tx As Integer = y(0) + y(1) + y(2) + y(3)
rr1.Text = RadioButton1.Text
rr2.Text = RadioButton2.Text
rr3.Text = RadioButton3.Text
rr4.Text = RadioButton4.Text
v1.Text = CStr(y(0)) & "صوت"
h1.Text = CStr(CInt((y(0) / tx) * 100))
Image1.Width = CInt(h1.Text * 2)
v2.Text = CStr(y(1)) & "صوت"
h2.Text = CStr(CInt((y(1) / tx) * 100))
Image2.Width = CInt(h2.Text * 2)
v3.Text = CStr(y(2)) & "صوت"
h3.Text = CStr(CInt((y(2) / tx) * 100))
Image3.Width = CInt(h3.Text * 2)
v4.Text = CStr(y(3)) & "صوت"
h4.Text = CStr(CInt((y(3) / tx) * 100))
Image4.Width = CInt(h4.Text * 2)
Dim ck1 As New HttpCookie("vv", "t")
Response.Cookies.Add(ck1)
ck1.Expires = Now.AddDays(20)
End Sub
End Class