|
Hi cadi,
Thanks for your help.
can you little bit change your code
my job.txt file is given below
-----------------------------
1,2,3,4,5,6,7
1,2,3,4,5,6,7
1,2,3,4,5,6,7
1,2,3,4,5,6,7
1,2,3,4,5,6,7
1,2,3,4,5,6,7
1,2,3,4,5,6,7
1,2,3,4,5,6,7
5,6,7,4,5,6,7
1,2,3,4,5,6,7
1,2,3,4,5,6,7
1,2,3,4,5,6,7
1,2,3,4,5,6,7
1,2,3,4,5,6,7
1,2,3,4,5,6,7
1,2,3,4,5,6,7
1,2,3,4,5,6,7
here in this file total rows is 15 .
If the file length is greater then 10 rows then all the previous records will appended to oldjob.txt
In your program you have created random no and stored in oldjob.txt
I want that all the previous records more then 10 lines will be copied to oldjob.txt.
File length should not greater than 10 rows or 10 lines.
If currently 5 rows to be displayed but job.txt aleardy has 10 rows. then 10 rows will be appended to oldjob.txt
can you do that
thansk again for your kind help
regards
sanjeev
|
|
|
|
|
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
|
|
|
|
|
Hi
i would to customise the Size of a Button on a Form by mouving the Mouse(like designing Forms and Controls in VS)
an idea?
Thanks
simo
|
|
|
|
|
In runtime ?,you could override the mousedown event.
|
|
|
|
|
I am using Interop.Word.dll COM object to create a spell ckecking tool for a c# web application.
It works fine from my localhost, however when I run the application remotely from another web server I get the following exception error.
System.Runtime.InteropServices.COMException: COM object with CLSID {000209FF-0000-0000-C000-000000000046} is either not valid or not registered.
Also, I linked to my localhost from another PC (MS Word is installed in both machines) and it didn't work either.
The problem seem to be when accessing the object remotely.
Any help will be much appreciated
Thanks
Tony
|
|
|
|
|
|
if i set a my own 256 color to this.cursor, it is converted in a full black color.
How can i correctly load a 256 color in my application?
|
|
|
|
|
Hi all,
I have a simple login form to my application which displays textboxes for username, password and server (tabindexes in the order given). The user name and server values get set from the last login if they have been saved to a config file. In the form load event I check to see if the user name has been populated and if so I would like the password box to have focus e.g.
private void frmLogin_Load(object sender, System.EventArgs e)
{
if (txtUserName.Text.Length > 0)
txtPassword.Focus();
}
This doesn't work however. If I capture the result of the Focus call it returns false. Am I missing something simple here? I don't want to go the route of programatically changing the tab order.
|
|
|
|
|
or try
this.ActiveControl = txtPassword;
My Blog ^
|
|
|
|
|
|
Hello need help
How to retrive user log and log off time from active directory,
|
|
|
|
|
Rumor has it the last logout time is not replicated in Active Directory...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for your response how can i find log in time
|
|
|
|
|
Hi friends!
How can I create a self-executing file from within a C# application? What exactly I want is that I have a data file incorporating data which can be changed by the user. I want to give an option to the user to create a self-executing file from within my C# application which will contain that data file and in fact the self-executing file will itself be created with that data file name. One thing to remember - the data file name may change and the data may also change. So the self-executing file must be a flexible system.
Subsequently, one should be able to run this data file through that self-executing file even though my C# application might not be available.
Thanks in advance and regards!!!
|
|
|
|
|
Create your "self executing" program as a standalone program reading its data out of a Win32 resource block.
Now embed this self executing application in your main program. When needed get the executable out of the resource manager, write it to disk with the appropriate name and add the data file to it using the Win32 API to update resource blocks.
Maybe you can also use a standard .NET resource - I never tried, but if it is possible it's probably easier than dealing with Win32 API.
|
|
|
|
|
I have seen so many browsing LDAP applications. However, i can't find a property returned from DirectorySearcher.FindAll() that gives me the user's password ? I have some reason that i need to get into the remote AD to get a particular user name and his/her password. But it seems that I can't easily get it T_T
Please help
|
|
|
|
|
For security reasons it is not possible to retreive the password from the AD.
If youl realy need access to the passwords you would have to write an AD-Plugin that captures password changes (and only changes).
This i a little like replacing the GINA and capturing passwords during login.
And btw. this is faaar away from easliy
/cadi
24 hours is not enough
|
|
|
|
|
Tee+ wrote:
But it seems that I can't easily get it T_T
You can't get it at all! No directory service, worth anything anyway, will ever tell you what the users password is.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Png images file has got multilevel property.
So i can create by a graphic application like Photoshop a png like this.
Now I need to load that (a multilevel png file) within my application all levels and set them in separate bitmap (every level in a new single level png).
How can i do?
Please help me, tnx.
|
|
|
|
|
Can I access all IO ports in C#?
(the Parallel port and the Serial Port)
Can I set each pin on and off in c#?
How?
The PROgrammer Niklas Ulvinge aka IDK
|
|
|
|
|
I havn't experiented with LPT but with Serial there is only one DATA+ pin and DATA- pin.
For example:
<br />
SerialPort comPort = new SerialPort("COM1");<br />
comPort.Open();<br />
for (int i=0; i<1; i=0){<br />
comPort.Write("1");
}<br />
comPort.Close();<br />
I hope this helps a little.
(Use pin 3 & 5)
Here's a diagram of a serial port I scanned:
http://home.bresnan.net/~bcreavis/page2.jpg
|
|
|
|
|
I want to turn every pin on and off.
Is this possible?
Or do I need to make some hardware to do this?
The PROgrammer Niklas Ulvinge aka IDK
|
|
|
|
|
|
OK, thanks for letting me know.
The PROgrammer Niklas Ulvinge aka IDK
|
|
|
|
|
I have a C++ dll that opens an image file using GDI+ and gets a thumbnail of the opened image using GetThumbnailImage. I would like the C++ DLL to be able to return a pointer to the Image and then have a custom C# control of mine display it. Does anyone know how I can share this image information between the two languages? (I know I can use C#'s GDI image functions to create the thumbnail also, but the C++ version is much faster).
|
|
|
|
|