Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to Export gridview data to Excel file in VB.NET standalone application

How to Export gridview data to Excel file in VB.NET standalone application

Scheduled Pinned Locked Moved Visual Basic
csharphelptutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jats_4ru
    wrote on last edited by
    #1

    I need to Export data in a Gridview to Excel file, please any body help... I tried a lot but could'nt make it. The application is made in VB.NET standalone (NOT web based) I have a gridview with data, i need to export it to .xls or .csv file please help...

    Jats

    D P 2 Replies Last reply
    0
    • J Jats_4ru

      I need to Export data in a Gridview to Excel file, please any body help... I tried a lot but could'nt make it. The application is made in VB.NET standalone (NOT web based) I have a gridview with data, i need to export it to .xls or .csv file please help...

      Jats

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Don't cross post. You already posted this same question in the article I would have pointed you at. If you can't read the article and code in it and understand what it does, noone is going to be able to explain the process to you in a much shorter forum post that will offer nowhere near as much explanation. If you want other examples you can try, Google for "VB.NET export data to Excel".

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      J 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Don't cross post. You already posted this same question in the article I would have pointed you at. If you can't read the article and code in it and understand what it does, noone is going to be able to explain the process to you in a much shorter forum post that will offer nowhere near as much explanation. If you want other examples you can try, Google for "VB.NET export data to Excel".

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        J Offline
        J Offline
        Jats_4ru
        wrote on last edited by
        #3

        Sorry for cross posting. But the code project page was showing error when i posted in the article. So i posted here again. May be the CodeProject site is not working properly. I suppose. By the way i read the article and understood very well but i have no knowledge of C# so hoping some body can help me.

        Jats

        D 1 Reply Last reply
        0
        • J Jats_4ru

          Sorry for cross posting. But the code project page was showing error when i posted in the article. So i posted here again. May be the CodeProject site is not working properly. I suppose. By the way i read the article and understood very well but i have no knowledge of C# so hoping some body can help me.

          Jats

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Jats_4ru wrote:

          but i have no knowledge of C#

          BS. You know more than you think you do. Take a look at a bunch of documentation in the MSDN Help for Visual Studio. Notice that there are thousands of examples of small bits of code in both C# AND VB.NET. Compare the two and you'll find C# has a lot in common with VB. Most of what you see has nothing to do with either language anyway since alot of code just manipulates objects in the .NET Framework. For example, these two pieces out of the MSDN docs on the ManagementObjectSearcher class are, line-for-line, identical:

          ' VB.NET
          Imports System
          Imports System.Management

          Public Class Sample
          Public Overloads Shared Function _
          Main(ByVal args() As String) As Integer

              Dim s As New ManagementObjectSearcher( \_
                  "root\\MyApp", \_
                  "SELECT \* FROM Win32\_Service", \_
                  New EnumerationOptions( \_
                  Nothing, System.TimeSpan.MaxValue, 1, \_
                  True, False, True, True, False, \_
                  True, True))
          
              For Each service As ManagementObject In s.Get()
                  'show the instance
                  Console.WriteLine(service.ToString())
              Next
          End Function
          

          End Class

          // C#
          using System;
          using System.Management;

          public class Sample
          {
          public static void Main(string[] args)
          {
          ManagementObjectSearcher s =
          new ManagementObjectSearcher(
          "root\\CIMV2",
          "SELECT * FROM Win32_Service",
          new EnumerationOptions(
          null, System.TimeSpan.MaxValue,
          1, true, false, true,
          true, false, true, true));

              foreach (ManagementObject service in s.Get()) 
              {
                  // show the service
                  Console.WriteLine(service.ToString());
              }
          }
          

          }

          All you have to do is compare each line to see that they both specify the exact same things, just using a slightly different syntax.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          1 Reply Last reply
          0
          • J Jats_4ru

            I need to Export data in a Gridview to Excel file, please any body help... I tried a lot but could'nt make it. The application is made in VB.NET standalone (NOT web based) I have a gridview with data, i need to export it to .xls or .csv file please help...

            Jats

            P Offline
            P Offline
            Paul Conrad
            wrote on last edited by
            #5

            Don't cross post. It's just plain rude.

            "The clue train passed his station without stopping." - John Simmons / outlaw programmer

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups