VB.net Code Convert to C#

  • Imports System.Text.RegularExpressions
    Imports System.Threading
    Imports xNet
    Public Class Form1
        Public Sub New()
            ' This call is required by the designer.
            Control.CheckForIllegalCrossThreadCalls = False
        End Sub
        Public Sub Login()
            Dim index As Integer = 0
            While index < Combos.Count
                Dim str() As String = Combos(index).Split(":")
                Using req As New HttpRequest
                    req.UserAgent = Http.ChromeUserAgent
                    req.Cookies = New CookieDictionary(False)
                    req.Proxy = Nothing
                    req.IgnoreProtocolErrors = True
                    req.AddParam("username", str(0))
                    req.AddParam("password", str(1))
                    Dim respo As String = req.Post("Examle.com").ToString
                    If respo.Contains("Logout") Then
                        good.Text += 1
                        Dim SA As Match = Regex.Match(respo, "")
                        Dim IT As New ListViewItem
                        IT.Text = str(0)
                        bad.Text += 1
                    End If
                End Using
                index += 1
            End While
        End Sub
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Dim IH As New Thread(AddressOf Login) : IH.Start()
        End Sub
        Dim Combos As New List(Of String)
        Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
            Dim o As New OpenFileDialog
            o.Filter = "txt|*.txt"
            If o.ShowDialog = Windows.Forms.DialogResult.OK Then
                For Each Line As String In IO.File.ReadAllLines(o.FileName)
            End If
        End Sub
    End Class

    Can someone please help?
    I want to convert VB.net code to C # code
    I only know C # language

  • This is not C++ but VB.net

    I used a converter and didn't test it:

    using System.Text.RegularExpressions;
    using System.Threading;
    using xNet;
    public class Form1
        public Form1()
            // This call is required by the designer.
            Control.CheckForIllegalCrossThreadCalls = false;
        public void Login()
            int index = 0;
            while (index < Combos.Count)
                string[] str = Combos[index].Split(":");
                using (HttpRequest req = new HttpRequest())
                    req.UserAgent = Http.ChromeUserAgent;
                    req.Cookies = new CookieDictionary(false);
                    req.Proxy = null;
                    req.IgnoreProtocolErrors = true;
                    req.AddParam("username", str[0]);
                    req.AddParam("password", str[0]);
                    string respo = req.Post("Examle.com").ToString;
                    if (respo.Contains("Result"))
                        Match link = Regex.Match(respo, "Result\":\"(.*?)\",");
                index += 1;
        private void Button1_Click(object sender, EventArgs e)
            Thread IH = new Thread(Login); IH.Start();
        private List<string> Combos = new List<string>();
        private void Button2_Click(object sender, EventArgs e)
            OpenFileDialog o = new OpenFileDialog();
            o.Filter = "txt|*.txt";
            if (o.ShowDialog == Windows.Forms.DialogResult.OK)
                foreach (string Line in System.IO.File.ReadAllLines(o.FileName))

  • @masterchief

    Thank you soo much

  • @masterchief

    Can you share the converter with me?
    Much needed
    if possible

  • @masterchief
    great Thanks

  • Code not working

  • tell me about the errors

    by the way, you must add xNet library to your project first

Log in to reply