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. open ascii file

open ascii file

Scheduled Pinned Locked Moved Visual Basic
tutorialquestion
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.
  • T Offline
    T Offline
    toto_plg
    wrote on last edited by
    #1

    if i have a ascii file, example: 2 4 3 40 42 56 etc... how to open this file? how to show this file in listview or datagrid? how to save in a ascii file if i have this data thank

    C D 2 Replies Last reply
    0
    • T toto_plg

      if i have a ascii file, example: 2 4 3 40 42 56 etc... how to open this file? how to show this file in listview or datagrid? how to save in a ascii file if i have this data thank

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      This stuff is much nicer in C++, but in VB.NET you can still use the System.IO namespace to read and write files. In fact, a quick google will overload you with the information you need. Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer

      1 Reply Last reply
      0
      • T toto_plg

        if i have a ascii file, example: 2 4 3 40 42 56 etc... how to open this file? how to show this file in listview or datagrid? how to save in a ascii file if i have this data thank

        D Offline
        D Offline
        dpagka
        wrote on last edited by
        #3

        Use the following Code. Put an AsciiFile.txt with the data 2 4 3 40 42 56 in the applications path Imports System.IO Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents ListView1 As System.Windows.Forms.ListView Friend WithEvents ColumnHeader1 As System.Windows.Forms.ColumnHeader Friend WithEvents ColumnHeader2 As System.Windows.Forms.ColumnHeader Private Sub InitializeComponent() Me.Button1 = New System.Windows.Forms.Button Me.ListView1 = New System.Windows.Forms.ListView Me.ColumnHeader1 = New System.Windows.Forms.ColumnHeader Me.ColumnHeader2 = New System.Windows.Forms.ColumnHeader Me.SuspendLayout() ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(200, 232) Me.Button1.Name = "Button1" Me.Button1.TabIndex = 0 Me.Button1.Text = "Button1" ' 'ListView1 ' Me.ListView1.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1, Me.ColumnHeader2}) Me.ListView1.Location = New System.Drawing.Point(8, 8) Me.ListView1.Name = "ListView1" Me.ListView1.Size = New System.Drawing.Size(264, 192) Me.ListView1.TabIndex = 1 Me.ListView1.View = System.Windows.Forms.View.Details ' 'ColumnHeader1 ' Me.ColumnHeader1.Width = 120 ' 'ColumnHeader2 ' Me.ColumnHeader2.Width = 135 ' 'Form1

        C 1 Reply Last reply
        0
        • D dpagka

          Use the following Code. Put an AsciiFile.txt with the data 2 4 3 40 42 56 in the applications path Imports System.IO Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents ListView1 As System.Windows.Forms.ListView Friend WithEvents ColumnHeader1 As System.Windows.Forms.ColumnHeader Friend WithEvents ColumnHeader2 As System.Windows.Forms.ColumnHeader Private Sub InitializeComponent() Me.Button1 = New System.Windows.Forms.Button Me.ListView1 = New System.Windows.Forms.ListView Me.ColumnHeader1 = New System.Windows.Forms.ColumnHeader Me.ColumnHeader2 = New System.Windows.Forms.ColumnHeader Me.SuspendLayout() ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(200, 232) Me.Button1.Name = "Button1" Me.Button1.TabIndex = 0 Me.Button1.Text = "Button1" ' 'ListView1 ' Me.ListView1.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1, Me.ColumnHeader2}) Me.ListView1.Location = New System.Drawing.Point(8, 8) Me.ListView1.Name = "ListView1" Me.ListView1.Size = New System.Drawing.Size(264, 192) Me.ListView1.TabIndex = 1 Me.ListView1.View = System.Windows.Forms.View.Details ' 'ColumnHeader1 ' Me.ColumnHeader1.Width = 120 ' 'ColumnHeader2 ' Me.ColumnHeader2.Width = 135 ' 'Form1

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          I think it's cool that you took the time to whip this up, but don't you think just the code that writes the file, along with a description of what it's doing, would be more helpful ? I personally thought that making the poster look for it themselves was more helpful again, given how elementary the question was. Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer

          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