simple vb to c#, help please

asp , csharp , vb København, Denmark
  • 11 years ago

    Hi, i'm new to c# and trying to learn it.. though it's hard that many tutorial is in vb :(

    Can anyone help me translate this vb to c#? and explain me what BlogContents.Contains is in C#?

       System.Threading.Thread.Sleep(2000)
    
        Dim db As New BlogDBDataContext()
    
        Dim q = From b In db.Blogs _
                Where b.BlogContents.Contains(txtSearch.Text.Trim()) Or _
                      b.BlogTitle.Contains(txtSearch.Text.Trim()) _
                Select b
    
        lv.DataSource = q
        lv.DataBind()
    

    Much of the code gets deleted when i try converting it online (vb-c#): 01 02.{ 03. System.Threading.Thread.Sleep(2000); 04. 05. BlogDBDataContext db = new BlogDBDataContext(); 06. 07. var q = ; 08. 09. lv.DataSource = q; 10. lv.DataBind(); 11.} thank you in advance
  • 11 years ago

    { System.Threading.Thread.Sleep(2000);

     BlogDBDataContext db = new BlogDBDataContext();
    
     var q = ;
    
     lv.DataSource = q;
     lv.DataBind();
    

    }

    Ths is C# code for wht u hv in VB..

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC. As potential programmers, they are mentally mutilated beyond hope of regeneration.” - E. W. Dijkstra