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. Uploading Data in C1.Win.FlexGrid From Excel.

Uploading Data in C1.Win.FlexGrid From Excel.

Scheduled Pinned Locked Moved Visual Basic
helpcsscom
4 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.
  • D Offline
    D Offline
    Dot Net Jantu
    wrote on last edited by
    #1

    Hi, I have a excel sheet, in that the fields are: Name,EmployeeID,Address,Email. Sourabh,757,New Bombay,something@something.com I have a C1.Win.FlexGrid in which I have put the same columns in this grid with one more colum in the starting as Select(Boolean). This is the code that I have written..... Dim ofd As New OpenFileDialog Dim dgtemp As C1.Win.C1FlexGrid.C1FlexGrid Dim fn As String = "" Dim sheetname() As String ofd.AddExtension = True ofd.DefaultExt = ".xls" ofd.Filter = "Microsoft Excel Workbook(*.xls)|*.xls" ofd.ShowDialog() fn = ofd.FileName txtFile.Text = fn dgtemp = New C1.Win.C1FlexGrid.C1FlexGrid **sheetname = dgtemp.LoadExcelSheetNames(fn)** dgtemp.LoadExcel(fn, sheetname(0), C1.Win.C1FlexGrid.FileFlags.IncludeFixedCells) Thje bold part of the code is giving error as: "Failed to open storage file." Help...

    Thanks and Regards,

    D C 2 Replies Last reply
    0
    • D Dot Net Jantu

      Hi, I have a excel sheet, in that the fields are: Name,EmployeeID,Address,Email. Sourabh,757,New Bombay,something@something.com I have a C1.Win.FlexGrid in which I have put the same columns in this grid with one more colum in the starting as Select(Boolean). This is the code that I have written..... Dim ofd As New OpenFileDialog Dim dgtemp As C1.Win.C1FlexGrid.C1FlexGrid Dim fn As String = "" Dim sheetname() As String ofd.AddExtension = True ofd.DefaultExt = ".xls" ofd.Filter = "Microsoft Excel Workbook(*.xls)|*.xls" ofd.ShowDialog() fn = ofd.FileName txtFile.Text = fn dgtemp = New C1.Win.C1FlexGrid.C1FlexGrid **sheetname = dgtemp.LoadExcelSheetNames(fn)** dgtemp.LoadExcel(fn, sheetname(0), C1.Win.C1FlexGrid.FileFlags.IncludeFixedCells) Thje bold part of the code is giving error as: "Failed to open storage file." Help...

      Thanks and Regards,

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

      You're going to have to go to ComponentOne's site for support[^] on this. It's functionality specific to their control.

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

      1 Reply Last reply
      0
      • D Dot Net Jantu

        Hi, I have a excel sheet, in that the fields are: Name,EmployeeID,Address,Email. Sourabh,757,New Bombay,something@something.com I have a C1.Win.FlexGrid in which I have put the same columns in this grid with one more colum in the starting as Select(Boolean). This is the code that I have written..... Dim ofd As New OpenFileDialog Dim dgtemp As C1.Win.C1FlexGrid.C1FlexGrid Dim fn As String = "" Dim sheetname() As String ofd.AddExtension = True ofd.DefaultExt = ".xls" ofd.Filter = "Microsoft Excel Workbook(*.xls)|*.xls" ofd.ShowDialog() fn = ofd.FileName txtFile.Text = fn dgtemp = New C1.Win.C1FlexGrid.C1FlexGrid **sheetname = dgtemp.LoadExcelSheetNames(fn)** dgtemp.LoadExcel(fn, sheetname(0), C1.Win.C1FlexGrid.FileFlags.IncludeFixedCells) Thje bold part of the code is giving error as: "Failed to open storage file." Help...

        Thanks and Regards,

        C Offline
        C Offline
        C1AllenS
        wrote on last edited by
        #3

        Hello, I have checked out the code at my end. It seems to be working fine. If the issue persists, I would suggest you to contact at the following email addresses for further assistance. support@componentone.com Regards,

        Allen Smith Software Engineer ComponentOne LLC www.componentone.com

        D 1 Reply Last reply
        0
        • C C1AllenS

          Hello, I have checked out the code at my end. It seems to be working fine. If the issue persists, I would suggest you to contact at the following email addresses for further assistance. support@componentone.com Regards,

          Allen Smith Software Engineer ComponentOne LLC www.componentone.com

          D Offline
          D Offline
          Dot Net Jantu
          wrote on last edited by
          #4

          Hi, That is solved, another problem now. Eg: I have a flexgrid with two columns(Select as boolean and Name as string) in which in the column of name I already have my name, now if i again upload a excelfile which has my name, in the datagrid my name should come checked. How do I do that. The thing which I have already done is as below: It will take some time for you to read this, but please read as I am stuck in a quick sand. Private Sub btnUpload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpload.Click Dim filename As String Dim od As New OpenFileDialog Dim SheetName() As String Try od.AddExtension = True od.DefaultExt = ".xls" od.Filter = "Microsoft Excel Workbook(*.xls)|*.xls" od.ShowDialog() filename = od.FileName SheetName = dgtmp.LoadExcelSheetNames(filename) dgtmp.LoadExcel(filename, SheetName(0), C1.Win.C1FlexGrid.FileFlags.IncludeFixedCells) Dim dgCol As C1.Win.C1FlexGrid.Column For Each dgCol In dgtmp.Cols dgCol.Name = dgtmp.Rows(0)(dgCol.Index) Next dgtmp.Cols.Add() dgtmp.Cols(dgtmp.Cols.Count - 1).Name = "SEL" dgtmp.Cols(dgtmp.Cols.Count - 1).DataType = System.Type.GetType("System.Boolean") objEms.RetrieveSearchData("FIS104", "BANK_CODE='" & BankCode & "'", "", sCompany, sPlant, dsRet, Nothing) If Not IsNothing(dsRet.Tables(0)) Then If dsRet.Tables(0).Rows.Count > 0 Then CLEARDATE = dsRet.Tables(0).Rows(0)("CLEAR_DATE") WITHDRAWLS = dsRet.Tables(0).Rows(0)("WITHDRAWLS") DEPOSITS = dsRet.Tables(0).Rows(0)("DEPOSITS") CHEQUENO = dsRet.Tables(0).Rows(0)("CHEQUE_NO") DESCRIPTION = dsRet.Tables(0).Rows(0)("DESCRIPTION") Else ShowMessage("Format not Defined", 30) End If End If Dim dgRow As C1.Win.C1FlexGrid.Row For Each dgRow In dgtmp.Rows 'If dgRow.Index > 0 Then If dgtmp.Rows.Count - 1 > 0 Then With dgBankReco **Dim curRow As Integer = .FindRow(dgRow(CHEQUENO), 0, .Cols("CHEQUE_NO").Index, False, True, False)** If Val(.Rows(curRow)("DEBIT").ToString()) = Val(IIf(IsNothing(dgRow(DE

          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