Announcement

Collapse
No announcement yet.

Another vb .net question...

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Another vb .net question...

    I have a datagrid which is populated by importing a csv file. It imports fine and i can modify the datagrid and save the data back. But how do you get the first line in the csv file to be the column headings?

    Or even better, i want the column headings to be static... how do you do that?

    Cheers

    Chris
    Server 2000 MCP
    Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

    ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

  • #2
    First make sure that the property to show headers is enabled.

    Datagrid1.ColumnHeadersVisible = True

    If this isn't the solution we'll look at it further.
    Andrew

    ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

    Comment


    • #3
      Hi Andrew

      Thanks for replying. I've got the header visible but it shows the column headings as F1 , F2, F3 etc...
      Server 2000 MCP
      Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

      ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

      Comment


      • #4
        http://www.vb-helper.com/howto_long_...ile_names.html

        Look at ExtractFileNameAndPath function at the bottom
        Guy Teverovsky
        "Smith & Wesson - the original point and click interface"

        Comment


        • #5
          Hi Guy. Thanks for the link, but this would have helped with my other problem which is now sorted. I am now having a problem with datagrid columns.
          Server 2000 MCP
          Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

          ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

          Comment


          • #6
            Originally posted by tonyyeb
            Hi Guy. Thanks for the link, but this would have helped with my other problem which is now sorted. I am now having a problem with datagrid columns.

            See these two here:

            http://www.knowdotnet.com/articles/cgrid.html

            http://www.wwwcoder.com/main/parenti...8/default.aspx

            I hope it help
            MCSE w2k
            MCSA w2k - MCSA w2k MESSAGING
            MCDBA SQL2k

            Comment


            • #7
              You can assign column names to the grid at design time. This only works if the table structure doesn't change. If the structure is dynamic then you'll need to control it programmatically and the first link Windux provided gives you some code that should help with that.

              Here's a screenshot:
              Attached Files
              Andrew

              ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

              Comment


              • #8
                I tried that and now my datagrid looks like this and i can't get it back:

                EDIT: Scrap that sorted it... going to try again!
                Attached Files
                Server 2000 MCP
                Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

                ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

                Comment


                • #9
                  Ok tried that and i get nothing. Ive tried adding

                  DataGrid1.TableStyles.Add(DataGridTableStyle1)

                  But that doesn't do anything. My app looks like this still. Do i need to put all the column names in as i am only trying the first one as a test?
                  Attached Files
                  Server 2000 MCP
                  Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

                  ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

                  Comment


                  • #10
                    Originally posted by tonyyeb
                    Hi Guy. Thanks for the link, but this would have helped with my other problem which is now sorted. I am now having a problem with datagrid columns.
                    Sorry, I obviously need more coffee. Wrong thread ...
                    Guy Teverovsky
                    "Smith & Wesson - the original point and click interface"

                    Comment

                    Working...
                    X