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