|
Mangesh Tomar wrote: string filename = @"textBox1.Text";
Is this what you intend to do?
Which line throws this exception?
जय हिंद
|
|
|
|
|
Two questions, related to the error "Cannot update. Database or object is read-only.";
- Are you "viewing" the sheet in Excel whilst running this code? If yes, then close it.
- Have you checked the properties of the file itself? Ie, it shouldn't be blocked etc.
I are troll
|
|
|
|
|
i want a regular exprssion for a string which doesnt starts with "SA" or "K" and this is case insensitive
fttyhtrhyfytrytrysetyetytesystryrty
|
|
|
|
|
I want to kick someone's ***. Lets pray together that our wishes are fulfilled.
जय हिंद
|
|
|
|
|
Use the algorithm from your signature.
|
|
|
|
|
Sounds easy enough, what do you have so far?
|
|
|
|
|
If the rest of the expression doesn't matter, then iterate through the string, if the first character is a K, then accept it, otherwise if the first character is an S, check the second character and if it is an A, then accept the string. That's pretty much a simple way of looking at it and should be easily written in C#. Try to convert that to C# code, and if you have issues, post what you have and we'll try to help further.
|
|
|
|
|
i am new to c#.net...i am having 90 text files having image intensity values...i am reading n th row of every text file and write it into newly created text file....i have done this in matlab .i am getting correct output...but in this program i have done something wrong...because of that the no.of columns are not same in each row...i couldn't get the output image....here is the program
private void button1_Click(object sender, EventArgs e)
{
try
{
string path1="c:\\Vicky\\DATAS\\OutputFiles";
string path2 = "\\";
string path4 = ".txt";
DirectoryInfo dir1 = new DirectoryInfo(path1);
dir1.Create();
DirectoryInfo Dir = new DirectoryInfo(@"C:\Vicky\DATAS\textfiles");
FileInfo[] FileList = Dir.GetFiles("c*.txt",SearchOption.AllDirectories);
for(int t=1;t<280;t++)
{
string path3=Convert.ToString(t);
string path=path1+path2+path3+path4;
FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs);
foreach (FileInfo FI in FileList)
{
FileStream fs1 = FI.OpenRead();
StreamReader sr = new StreamReader(fs1);
int i = 1;
while (sr.ReadLine() != null)
{
string d="";
if (t == i)
{
d = sr.ReadLine();
sw.WriteLine(d);
break;
}
i++;
}
}
}
}
|
|
|
|
|
you're writing 279 same files...plus
if (t == i)
{
d = sr.ReadLine();
sw.WriteLine(d);
break;
}
this will break in every first while loop
File.Copy() can do what you need
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
thanks for ur reply....i don't know how file.copy() method is going to help in this program.here i am not copying the file to another path...i am just reading the the same row of every text file and copy it into new file..and u told me that this program will write 279 same files...but i am getting 279 different text files with different memory sizes....
|
|
|
|
|
nettai wrote: ..but i am getting 279 different text files with different memory sizes....
yes, if you dont mind then your code is very tacky. All you need to do is that read all lines from each text file using File.ReadAllLines() as Danish said. That will return string[] and you can rip the line by index then add to the generic string list List<string></string> . When you done, write entire list using File.WriteAllLines() (you will need to use ToArray() to get the array from list).
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Take a look at File.ReadAllLines method. Now since you know the line number to read, just get that from the array returned. Then once you have read all the files, then write everything to the file in one go. This can be done using in built methods in File class.
Also, when you reply to anyone, use reply link in that very post and not your own.
जय हिंद
|
|
|
|
|
Hi,
I am using the following code to read the port number from xml file and send as a parameter to UdpClient.It works well. p1.xml file is stored in C:\projects\ports\10000...Simliarly i have stored p2.xml file in C:\projects\ports\10001 folder.p2.xml contains the port number 10001.
When the client clicks the C:\projects\ports\10000 path the exe in this path opens and communicates with the client by accepting the port 10000 from p1.xml.I am done with this step.
Suppose if the client clicks C:\projects\ports\10001 the exe opens .But now it should now accept the port as 10001 from p2.xml and do the communication with the client.Likewise for other ports also.
Please give me your ideas.
XmlTextReader xt = new XmlTextReader("p1.xml");
int p1=0;
while (xt.Read())
{
switch (xt.NodeType)
{
case XmlNodeType.Text:
String rv = xt.Value;
p1 = Convert.ToInt32(rv);
break;
}
}
listBox6.Items.Add("Connecting....");
UdpClient client = new UdpClient("127.0.0.1",p1);
|
|
|
|
|
Hi
I had a try with array of the port values. I have used an index that maps the directories to ports.I am stuck at a point.Since i am using the for loop it works well for i=0. i=1 should not execute before the server at C:\projects\ports\10001 starts.How can change this?Is there any loop construct that could help me perform this task?i should get incremented and do the same after the 2nd server starts.Can you please give your suggestions.I tried with break but still im not getting it right.
int[] a = new int[2];
XmlTextReader xtr1 = new XmlTextReader("p1.xml");
XmlTextReader xtr2 = new XmlTextReader("p2.xml");
int p1=0,p2=0;
while (xtr1.Read())
{
switch (xtr1.NodeType)
{
case XmlNodeType.Text:
String rv = xtr1.Value;
p1 = Convert.ToInt32(rv);
break;
}
}
while (xtr2.Read())
{
switch (xtr2.NodeType)
{
case XmlNodeType.Text:
String rv1 = xtr2.Value;
p2 = Convert.ToInt32(rv1);
break;
}
}
a[0] = p1;
a[1] = p2;
listBox6.Items.Add("Connecting....");
for (int i = 0; i <= 1; i++)
{
UdpClient client = new UdpClient("127.0.0.1", a[i]);
listBox6.Items.Add("Connected");
Byte[] data = new Byte[256];
String snd = "hello";
data = Encoding.ASCII.GetBytes(snd);
IPEndPoint ipep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), a[i]);
int n = client.Send(data, data.Length);
listBox6.Items.Add("Sent...");
listBox6.Items.Add("Message received from {0}:");
listBox6.Items.Add(ipep.ToString());
Byte[] received = new Byte[512];
received = client.Receive(ref ipep);
String dataReceived = System.Text.Encoding.ASCII.GetString(received);
listBox6.Items.Add(dataReceived);
|
|
|
|
|
how to do remote access of pc through internet using C#.how to transfer data.
|
|
|
|
|
did you read these "How to" questions somewhere or they just came in your mind. Well, first "How to" question is "How to use google ?". You just need to type www.google.com as you did for codeproject.com then type question you want as you wrote here. Simple...no ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi Experts
I am Varun.G , a Programmer.
I am stuck in a problem,thats y i make this question here..
I'll tell you in detail.
1.I made a software in .net 2005
2.It converts the data to an unknown format(though it is proper result of the software)
3.I created a new thread on making a new file extension for my
own software.(let call that as, .ass(as in mtb.ass).
4.isssue is ,how to associate these ,".ass" files in a purticular system with my software.
5.How to make the default application for these file types is my application.
EXPECT WISE REPLY..PLEASE...
THANX IN ADVANCE
|
|
|
|
|
Here[^] is an article.
जय हिंद
modified on Saturday, March 21, 2009 7:06 AM
|
|
|
|
|
d@nish wrote: It is done using FileAssociationInfo.
Its not inbuilt
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
corrected.
जय हिंद
|
|
|
|
|
|
I have written following code.
I have selected Project type as Visual C# -->
Smart Devise --> Windows CE 5.0
When i built the solution i am getting error as
"'System.Windows.Forms.Application' does not contain a definition for 'Idle'"
int counter = 0;
private void Form1_Idle(object sender, System.EventArgs e)
{
counter++;
label1.Text = counter.ToString();
}
private void Form1_Load(object sender, System.EventArgs e)
{
Application.Idle +=new EventHandler(Form1_Idle);
}
how to handle Idle event.
thanks
|
|
|
|
|
Just add..
private void Form1_Idle(object sender, EventArgs e)<br />
{<br />
}
Kelvin
|
|
|
|
|
saksp wrote: I have selected Project type as Visual C# -->
Smart Devise --> Windows CE 5.0
The .NET Compact Framework doesn't support the Application.Idle event. It is only supported by the .NET Framework.
|
|
|
|
|
Any one know an easy way to add a media player to a c# web form? Also, how do you play music on the login page?
|
|
|
|