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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
G

guchu

@guchu
About
Posts
8
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • [Message Deleted]
    G guchu

    [Message Deleted]

    C#

  • Excel Parseing
    G guchu

    Thankyou very much ... the answer was not only precise but was very well explained :)

    C# help

  • Excel Parseing
    G guchu

    Excel.Application ExcelApp = new Excel.ApplicationClass(); ExcelApp.Visible = false; String WorkbookPath = filename; Excel.Workbook ExcelWorkbook = ExcelApp.Workbooks.Open(WorkbookPath, 0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true, false, false); Excel.Worksheet Sheet = (Excel.Worksheet)ExcelWorkbook.Sheets[1]; DataTable newTable = new DataTable(); string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename + ";Extended Properties= Excel 8.0"; OleDbConnection conn = new OleDbConnection(strConn); conn.Open(); OleDbCommand cmd = new OleDbCommand("SELECT * FROM [" + Sheet + "$]", conn); cmd.CommandType = CommandType.Text; OleDbDataAdapter da = new OleDbDataAdapter(cmd); da.Fill(newTable); dataGridView1.DataSource = newTable; I am using this code to read an excel file and save the data in a datatable .... I am getting this error "System.__ComObject$' is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long." and the error pointer comes on the second last line of the code ... can neone help

    C# help

  • importing data from a xls file to an array
    G guchu

    I will go through the documentation and redesign the program .... i will get back to u if i have any quaries regarding this ... as of now thank you very much for helping me out ....

    C# csharp data-structures help

  • importing data from a xls file to an array
    G guchu

    i understand that u want me to learn the easier method but even using this one i am able to open the file if i specify the file name as "C:\....\a.xls" ... all i want to know is if i want to take this last part(a.xls) from the user since the file neways has to be on the desktop then how do i accomodate it in the code ... i have tried doing it using the + operator but it is not done this way as it seems as the compiler doesnt reads the remaining thing written outside "" ... i would be obliged if u can help ... i need it desperately

    C# csharp data-structures help

  • importing data from a xls file to an array
    G guchu

    as i have told u that i am new to c# hence i might have done it the harder way ... but it will be easy for me to understand if u can give me the code ... what i did was ... for the text box i wrote... this.textbox1 = new system.windows.forms.textbox(); string a = textbox1.text, then in the button 1 part for opening the code i want to insert this string a as the file name in the file path string workbookpath = @ "c:\.....\" + a ; but this doesnt works ... can u tell me the correct way

    C# csharp data-structures help

  • importing data from a xls file to an array
    G guchu

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Reflection; using Excel = Microsoft.Office.Interop.Excel; I am learning to use c# at the moment .. i have this code to read an excel file ... its incomplete now asi am yet to define the other varibles but as of now i want to have a user input in textbox1 and then that is to be the file name of the excel file to open ... can ne one help me namespace WindowsFormsApplication7 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void label1_Click(object sender, EventArgs e) { } private void textBox1_TextChanged(object sender, EventArgs e) { } private void label2_Click(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { try { // open the users excel workbook. Excel.Application ExcelApp = new Excel.ApplicationClass(); ExcelApp.Visible = true; String WorkbookPath = "c:/Users/Guchu/Desktop/a.xls"; Excel.Workbook ExcelWorkbook = ExcelApp.Workbooks.Open(WorkbookPath, 0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true,false,0,true,false,false); Excel.Sheets excelSheets = ExcelWorkbook.Worksheets; string CurrentSheet = "CurrentSheet"; excelSheets = (Excel.Sheets) excelSheets.get_Item(CurrentSheet); } catch (Exception theException) { String errorMessage; errorMessage = "Error: "; errorMessage = String.Concat(errorMessage, theException.Message); errorMessage = String.Concat(errorMessage, " Line: "); errorMessage = String.Concat(errorMessage, theException.Source); MessageBox.Show(errorMessage, "Error"); } } private void button2_Click(object sender, EventArgs e) { } } }

    C# csharp data-structures help

  • importing data from a xls file to an array
    G guchu

    can neone help me with importing data from a xls file to an array ... i am not using databases and i want it to be importes into an array in c# class :^)

    C# csharp data-structures help
  • Login

  • Don't have an account? Register

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