|
what's the difference between doing a button and just dumping code into the Checkbox clicked event?
|
|
|
|
|
It always works for me.
But there is no difference, I didn't understand you already used a userevent (checkbox clicked). But have you tried not to reload the form, but only reload the data?
|
|
|
|
|
using something like checkbox.update();
?
|
|
|
|
|
No,
You've got some form, this is your outputscreen, the way you debug, right?
So let's say you have one label named outputLabel and one checkbox.
When you initialize, you will probably do something like this:
public Form()
{
InitializeComponents();
outputLabel.Text = getDataFromDatabase();
}
and then something happens and the values changes, but you won't see those values, because you didn't update your form.
So in your case you will do something like this:
public void checkBox_Clicked(object sender, EventArgs e)
{
Form.Reload();
}
but in stead of this, you have to only refresh the values in the textboxes/labels. Something like this:
public void checkBox_Clicked(object sender, EventArgs e)
{
outputLabel.Text = getDataFromDatabase();
}
that's all. If it is something else, you should place some code of the eventhandling.
|
|
|
|
|
|
well I couldn't find a command called getfromdatabase.
Did you mean I would have to create my own subroutine and storage variable?
I did that for a checkbox, so now when the checkbox is changed a static boolean variable is swithced. That works for checkboxes, but implementing it for textboxes for instance might prove cumbersome.
|
|
|
|
|
No, all I did was asuming. I asumed you would get data from a 'place' and that 'place' would be getFromDatabase().
But to recap, to clear that I understand your problem well:
You have a form which you create and can own
You have a process running on a computer
This process will change some stuff and you want to get those on your form for debugging.
To refresh, you are using a checkbox with an OnChanged event?
But when you click on the checkbox, nothing happens.
Is this correct?
If it is, please send the code which is inside the OnChanged event. Then I can maybe see the problem.
If there is no code inside this event, then I would suggest you to call a function which will place the values you would like to see/debug, on your screen.
|
|
|
|
|
i have problem when use axwinsock in c#
when call load winsock in vb6
what equal to this in c#
If Index = 0 Then
anzVerbindung = anzVerbindung + 1
Load Winsck(anzVerbindung)
With Winsck(anzVerbindung)
.LocalPort = 0
.Accept requestID
End With
End If
how to convert this code to c#
|
|
|
|
|
Why don't you use System.Net.Sockets?
Regards,
Rob Philpott.
|
|
|
|
|
Rewrite the code using System.Net.Sockets. You do not want to use the old WinSock control.
|
|
|
|
|
how can I put in process simultaneously all the txt files in folder?Also I want to save a different folder the same name all the txt files.
please can you show on the code?
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
class MainClass
{
public static void Main(string[] args)
{
string inFile, filePath;
string line;
DirectoryInfo di = new DirectoryInfo(@"D:\a\");
FileInfo[] files = di.GetFiles("*.txt");
Console.WriteLine("Input file name to open!");
Console.WriteLine("Sample: d:\\filename.txt");
inFile = Convert.ToString(Console.ReadLine());
StreamReader sr = File.OpenText(inFile);
line = sr.ReadLine();
foreach (FileInfo fi in files)
{
inFile = fi.FullName;
Console.WriteLine();
Console.WriteLine("Successful file open!...");
Console.WriteLine();
Console.WriteLine("Input file name to save!");
Console.WriteLine("sample: d:\\filename.txt");
filePath = Console.ReadLine();
FileStream file = new FileStream(filePath, FileMode.Create);
StreamWriter sw = new StreamWriter(file);
List<string> lines = new List<string>();
while ((line = sr.ReadLine()) != null)
{
lines.Add(line);
}
try
{
int numberOne = Int32.Parse(lines[0]);
int numberTwo = Int32.Parse(lines[1]);
int numberThree = Int32.Parse(lines[2]);
int x = numberOne + numberTwo + numberThree;
sw.WriteLine(x);
}
catch { }
sw.Close();
sr.Close();
}
}
}
</string></string>
|
|
|
|
|
USE A LOOP AND STOP ASKING TWICE IN 2 DAYS, YOU ALREADY GOT HELP. FUCK BOLD TEXT IS ANNOYING, ISN'T IT!!!!!!!!!!!!!
|
|
|
|
|
|
this is your original thread[^]. Notice the missing posts? Those are yours. Way to delete them, that way if someone comes and actually searches the forums for a problem similar to yours, they won't find it. Because you're an asshat.
Secondly, read this[^] now that you've posted more then 5 times, you still don't follow those rules and if you post more then 5 time's, you really should be able to by now.
You received an answer in your previous thread, do not ask again until you try something new and get stuck there, you have not rendered any additional code or attempted a new method to accomplish your task, so the old answers still stick.
|
|
|
|
|
you are right.
Excuse me
|
|
|
|
|
NO! STUPID F* WHO CAN'T THINK ARE ANNOYING!
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
problem solved.
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
class MainClass
{
public static void Main(string[] args)
{
string inFile;
string line;
const string inDir = "D:\\data\\A\\";
const string outDir = "D:\\data\\B\\";
DirectoryInfo di = new DirectoryInfo(inDir);
FileInfo[] files = di.GetFiles("*.txt");
foreach (FileInfo fi in files)
{
inFile = fi.FullName;
StreamReader sr = File.OpenText(inFile);
List<string> lines = new List<string>();
while ((line = sr.ReadLine()) != null)
{
lines.Add(line);
}
int numberOne = Int32.Parse(lines[0]);
int numberThree = Int32.Parse(lines[2]);
int x = numberOne + numberThree;
sr.Close();
string destFile = Path.Combine(outDir, fi.Name);
File.WriteAllText(destFile, Convert.ToString(x));
}
}
}
</string></string>
|
|
|
|
|
I have opened a exe file using
System.Diagnostic.Process.Start("filename");
I want to close the opened exe file..
How do i go about it
Thanks for any help in advance
|
|
|
|
|
If you don't have the process handle, use Process.GetProcesses(); to get all running processes, search for your process, and destroy by using Kill() method.
Calin
modified on Wednesday, February 18, 2009 11:46 AM
|
|
|
|
|
Here is your solution:
using System.Diagnostics;
...
Process newProc;
newProc = Process.Start("filename");
...
newProc.CloseMainWindow();
The newProc.CloseMainWindow() method is used for Window apps. For Console apps use the newProc.Kill(); method instead.
|
|
|
|
|
Hi,
I used
proc.CloseMainWindow();
for closing the exe file.
It works well, but i have opened more than one exe file.
This code does not work for that case..
|
|
|
|
|
for more then one process, you can use List<Process> procList = new List<Process>(); and you can manipulate all of the started processes individually.
List<Process> procList = new List<Process>();
...........
Process newProc;
newProc = Process.Start("filename1");
procList.Add(newProc);
newProc = Process.Start("filename2");
procList.Add(newProc);
...............
foreach (Process p i in procList)
p.CloseMainWindow();
Hope this helps!
modified on Thursday, February 19, 2009 4:44 AM
|
|
|
|
|
Hi,
It works well..
Thanks for the help
|
|
|
|
|
You welcome!
|
|
|
|
|
hi
Any idea on how to draw a line similar to the one present in ms word, the line can be rotated about 360 degrees and also it can be resizable, movable. It should be like a control with all events. Please let me know if there is any way to do this. Sending Source code is also fine with me.
any article talking about this ??????
thanx
|
|
|
|