|
|
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();
}
}
}
}
************************************************************************************
|
|
|
|
|
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
|
|
|
|
|
i want it to scroll continously from bottom to top when d form is being loaded !!!
|
|
|
|
|
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
|
|
|
|
|
ohhkk....
Wat if i display d values in d form of labels. Then can i scroll / move the labels from bottom to top continously !!!
|
|
|
|
|
Yeah, but then you'd have to position these labels, whereas a listview has built-in functionality for that.
I are troll
|
|
|
|
|
Hi all,
Is there a way that i can use inline and attachment at the same time in content-disposition for Response Headers?
i have code like this
HttpContext.Current.Response.AddHeader("Content-disposition", "inline; filename=__aaa.pdf");
I want to open the file first in the browser and then open the dialog box for download as well.
How can i do that?
I tried to AddHeader again after that line of code and replaced the "inline" with "attachment", but that didn't work.
Please help me.
Thanks alot!
-ewin
|
|
|
|
|
Make two pages out of it; use the first page to display it, the second page to download it. Next, embed the first page into page two (using a frame?)
I are troll
|
|
|
|
|
Eddy,
thanks, i saw that our website already using the concept you suggested, you just enlighten me. haha thanks alot!
-ewin
|
|
|
|
|
I am trying open a excel file after downloading it from website, but its giving error "Missing file: C:\default.css?5".how can i overcome the error thru C# as all the file download are automated thru C#
Thanks
Senz
|
|
|
|
|
Hi all,
I'm using \n to create a new line when I wrote to a text file. Here's how I'm writing the string:
File.AppendAllText(destinationpath.Text, "Hi, this is a\n multiline\n text\n file.");
Now, it's not working.When I open the text file that was created, the whole thing's just a single line, but where the new line should have been created, there is a weird-looking square in its place. I've used \n to create new lines in the past and it worked perfectly but it doesn't want to work anymore. Does anyone have any ideas?
Jay.
foreach( inch on Jason )
{
Girlfriend.IsHappier();
}
|
|
|
|
|
Try this
File.AppendAllText(destinationpath.Text, "Hi, this is a" + Environment.NewLine + " multiline...");
|
|
|
|
|
Yay! Thanks afree it worked.
foreach( inch on Jason )
{
Girlfriend.IsHappier();
}
|
|
|
|
|
newlines are actually carrige return + linefeed. which for you is \r\n or use Environment.Newline as suggested above.
|
|
|
|
|
Hey all! ,
I'm not expecting any replies but I'd appreciate them. I'm trying to figure out how I would go about capturing a link-click in internet explorer. What I want to do is when I click on a download link for example I click link on say www.download.com to download a program and instead of having the internet explorer download window appear, my program will become visible and download the file relating to that link I clicked on. I have tried searching for this on Google and haven't found anything but I'm sure it's just how I'm searching for it, I've run out of search phrases lol.
Regards,
Jay.
foreach( inch on Jason )
{
Girlfriend.IsHappier();
}
|
|
|
|
|
|
Great article sebastian, thanks for the link!
foreach( inch on Jason )
{
Girlfriend.IsHappier();
}
|
|
|
|
|
Hi all,
I converted a number from a TextBox and a problem happened.
TextBox.Text = "616753008";
After converting to a float the value is 6.16753E+8. (I debug in code)
And then this number is saved into DB is 616753024
I do not know what happen.
Pls tell me how I can solve this problem.
Thanks in advance.
Phuc PHAM
|
|
|
|
|
6.16753E+8 is equal to 616753024
its the same, well almost, the first is less precise
EDIT: sorry i missed what your problem was... what about trying to convert to a double instead of a float
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
objStockCard.Pump is float;
objStockCard.Pump = Convert.ToSingle(txtPrice.Text);
So I use Convert.ToSingle (Convert.ToDouble is exact but complier does not accept set a double variable to a float variable).
Pls tell me how I can do now. I do not want to change objStockCard.Pump type.
Thanks for your reply.
|
|
|
|
|
can you not use
float.parse(txtPrice.Text);
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
The same result.
I think I must change DataType to Double.
Anyway, I would like to thank for your help.
Phuc PHAM
|
|
|
|
|
if your going to change the type try using a decimal[^] type, it seems to be a better option as a quick bit of googling says that floats and doubles are not to good for keeping precision of numbers.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|