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. C#
  4. how to scroll the text from bottom to top

how to scroll the text from bottom to top

Scheduled Pinned Locked Moved C#
databasegraphicshelptutorialquestion
6 Posts 2 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.
  • M Offline
    M Offline
    mist_psycho
    wrote on last edited by
    #1

    The following code reads data from excel and displays it in the listview...I want the data displayed in the listview to scroll / move from bottom to top automatically !!!!!.......... hw can i do it ????.....Plz help !!! ************************************************************************************** using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Excel; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { string Path = @"c:\gg.xls"; Excel.ApplicationClass app = new ApplicationClass(); Excel.Workbook workBook = app.Workbooks.Open(Path, 0, true, 5, Type.Missing, Type.Missing, true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true); Excel.Worksheet workSheet = (Excel.Worksheet)workBook.ActiveSheet; int index = 0; object rowIndex = 2; object colIndex1 = 1; object colIndex2 = 2; try { while (((Excel.Range)workSheet.Cells[rowIndex, colIndex1]).Value2 != null) { rowIndex = 2 + index; string firstName = ((Excel.Range)workSheet.Cells[rowIndex, colIndex1]).Value2.ToString(); string lastName = ((Excel.Range)workSheet.Cells[rowIndex, colIndex2]).Value2.ToString(); listView1.Items.Add(firstName); //listView1.Items.Add("\n"); listView1.Items.Add(lastName); index++; } } catch (Exception ex) { app.Quit(); } } } } ************************************************************************************

    L 1 Reply Last reply
    0
    • M mist_psycho

      The following code reads data from excel and displays it in the listview...I want the data displayed in the listview to scroll / move from bottom to top automatically !!!!!.......... hw can i do it ????.....Plz help !!! ************************************************************************************** using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Excel; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { string Path = @"c:\gg.xls"; Excel.ApplicationClass app = new ApplicationClass(); Excel.Workbook workBook = app.Workbooks.Open(Path, 0, true, 5, Type.Missing, Type.Missing, true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true); Excel.Worksheet workSheet = (Excel.Worksheet)workBook.ActiveSheet; int index = 0; object rowIndex = 2; object colIndex1 = 1; object colIndex2 = 2; try { while (((Excel.Range)workSheet.Cells[rowIndex, colIndex1]).Value2 != null) { rowIndex = 2 + index; string firstName = ((Excel.Range)workSheet.Cells[rowIndex, colIndex1]).Value2.ToString(); string lastName = ((Excel.Range)workSheet.Cells[rowIndex, colIndex2]).Value2.ToString(); listView1.Items.Add(firstName); //listView1.Items.Add("\n"); listView1.Items.Add(lastName); index++; } } catch (Exception ex) { app.Quit(); } } } } ************************************************************************************

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      mist_psycho wrote:

      I want the data displayed in the listview to scroll / move from bottom to top automatically !!!!!

      So you want to fill the listview in reverse order, making the last read item the top-item in the listview? Or do you just want to scroll to the top when the loading is done?

      I are troll :)

      M 1 Reply Last reply
      0
      • L Lost User

        mist_psycho wrote:

        I want the data displayed in the listview to scroll / move from bottom to top automatically !!!!!

        So you want to fill the listview in reverse order, making the last read item the top-item in the listview? Or do you just want to scroll to the top when the loading is done?

        I are troll :)

        M Offline
        M Offline
        mist_psycho
        wrote on last edited by
        #3

        i want it to scroll continously from bottom to top when d form is being loaded !!!

        L 1 Reply Last reply
        0
        • M mist_psycho

          i want it to scroll continously from bottom to top when d form is being loaded !!!

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          If I understood correctly now, you want to load a record, add it to the bottom of the list, and scroll up? Load your list in the reverse order as now, inserting items at the top of the listview instead of the bottom :) That might slow down loading though, since it will wait for a repaint before loading the next one.

          I are troll :)

          M 1 Reply Last reply
          0
          • L Lost User

            If I understood correctly now, you want to load a record, add it to the bottom of the list, and scroll up? Load your list in the reverse order as now, inserting items at the top of the listview instead of the bottom :) That might slow down loading though, since it will wait for a repaint before loading the next one.

            I are troll :)

            M Offline
            M Offline
            mist_psycho
            wrote on last edited by
            #5

            ohhkk.... Wat if i display d values in d form of labels. Then can i scroll / move the labels from bottom to top continously !!!

            L 1 Reply Last reply
            0
            • M mist_psycho

              ohhkk.... Wat if i display d values in d form of labels. Then can i scroll / move the labels from bottom to top continously !!!

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Yeah, but then you'd have to position these labels, whereas a listview has built-in functionality for that.

              I are troll :)

              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