Click here to Skip to main content
15,891,951 members
Home / Discussions / C#
   

C#

 
GeneralDisplay data from text file to LISTVIEW Pin
ksanju10008-Jun-05 0:34
ksanju10008-Jun-05 0:34 
GeneralRe: Display data from text file to LISTVIEW Pin
Carsten Zeumer8-Jun-05 1:41
Carsten Zeumer8-Jun-05 1:41 
GeneralRe: Display data from text file to LISTVIEW Pin
ksanju10008-Jun-05 3:12
ksanju10008-Jun-05 3:12 
GeneralRe: Display data from text file to LISTVIEW Pin
Carsten Zeumer8-Jun-05 3:48
Carsten Zeumer8-Jun-05 3:48 
GeneralRe: Display data from text file to LISTVIEW Pin
ksanju10008-Jun-05 5:08
ksanju10008-Jun-05 5:08 
GeneralRe: Display data from text file to LISTVIEW Pin
Carsten Zeumer8-Jun-05 6:09
Carsten Zeumer8-Jun-05 6:09 
GeneralRe: Display data from text file to LISTVIEW Pin
ksanju10009-Jun-05 1:12
ksanju10009-Jun-05 1:12 
GeneralRe: Display data from text file to LISTVIEW Pin
ksanju10009-Jun-05 19:40
ksanju10009-Jun-05 19:40 
Hi,
Job.txt can store only 10 rows suppose job.txt has 14 rows previous 10 rows will be tranferred to oldjob.txt and last foru rows will be stored in job.txt

actaullty it counts in contructor how many rows are present in job.txt

here is the code
public Form1()
{
//
// Required for Windows Form Designer support
//
if (File.Exists(m_File1))
{
using(StreamReader sr = new StreamReader(this.m_File1) )
{
while (sr.ReadLine() != null)
this.m_LinesWritten++; //total no of rows in job.txt
MessageBox.Show(this.m_LinesWritten.ToString());
}
}
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

private void button11_Click(object sender, System.EventArgs e)
{
ArrayList ob=new ArrayList();

if (this.m_LinesWritten >= LIMIT)
{


MessageBox.Show("Reached limit");
StreamReader sr = new StreamReader("job.txt");
string line = sr.ReadLine();
line=line.Trim();
int count=1;
int i;
string fileName = "temp1.txt";
while (line != null)
{
string[] subItems = line.Split(',');

ListViewItem newItem=null;
string[] subItems1 = line.Split(',');
if (subItems.Length > 0)
{
newItem = new ListViewItem(subItems1[0].Trim());
if(count>10 )
{
for( i=0;i<subItems.Length;i++)
{
newItem.SubItems.Add(subItems1[i].Trim());
ob.Add(subItems1[i].Trim());

}
}

}
if(count>10 )
{

listView1.Items.Add(newItem);



}
line = sr.ReadLine();

count=count+1;
}

int l=ob.Count;
MessageBox.Show(ob.Count.ToString());
writer = File.AppendText(@"oldjob.txt");

for(int m=0;m<l;m++)
{

writer.Write((string)ob[m] + ",");
}

writer.Close();
}

here problem is that oldjob.txt stores all in one line

here is the structure of oldjob.txt
-------------------------
6,7,8,9,10,11,13,6,7,8,9,10,11,14,

i want in this structure
6,7,8,9,10,11,13
6,7,8,9,10,11,14

can you modify the above given code
regards
sanjeev

Everything is possible
Generalresize the Button control Pin
prinz_simo8-Jun-05 0:26
prinz_simo8-Jun-05 0:26 
GeneralRe: resize the Button control Pin
MoustafaS8-Jun-05 2:21
MoustafaS8-Jun-05 2:21 
GeneralMS Word spell checker Pin
Gktony8-Jun-05 0:01
Gktony8-Jun-05 0:01 
GeneralRe: MS Word spell checker Pin
Anonymous9-Jun-05 4:03
Anonymous9-Jun-05 4:03 
Generalload a 256 color cursor Pin
Anonymous7-Jun-05 23:40
Anonymous7-Jun-05 23:40 
GeneralText box not accepting focus Pin
GazzaJ7-Jun-05 23:14
GazzaJ7-Jun-05 23:14 
GeneralRe: Text box not accepting focus Pin
NormDroid8-Jun-05 0:10
professionalNormDroid8-Jun-05 0:10 
GeneralRe: Text box not accepting focus Pin
GazzaJ8-Jun-05 1:52
GazzaJ8-Jun-05 1:52 
GeneralLog in/Log out time from Active Directory Pin
Zapss7-Jun-05 22:38
Zapss7-Jun-05 22:38 
GeneralRe: Log in/Log out time from Active Directory Pin
Dave Kreskowiak8-Jun-05 6:56
mveDave Kreskowiak8-Jun-05 6:56 
GeneralRe: Log in/Log out time from Active Directory Pin
Zapss10-Jun-05 18:58
Zapss10-Jun-05 18:58 
GeneralCreating a self-executing file from within a C# application Pin
Anonymous7-Jun-05 22:34
Anonymous7-Jun-05 22:34 
GeneralRe: Creating a self-executing file from within a C# application Pin
Anonymous8-Jun-05 1:50
Anonymous8-Jun-05 1:50 
Questionuser's password from active directory ? Pin
Tee+7-Jun-05 22:31
Tee+7-Jun-05 22:31 
AnswerRe: user's password from active directory ? Pin
Carsten Zeumer7-Jun-05 22:36
Carsten Zeumer7-Jun-05 22:36 
AnswerRe: user's password from active directory ? Pin
Dave Kreskowiak8-Jun-05 6:52
mveDave Kreskowiak8-Jun-05 6:52 
Generalload multilevel png files Pin
Anonymous7-Jun-05 21:42
Anonymous7-Jun-05 21:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.