simple vb to c#, help please

asp , csharp , vb København, Denmark
  • 10 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
  • 9 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.

“The greatest performance improvement of all is when a system goes from not-working to working.” - John Ousterhout