|
I've managed to get the name out of the first column using lstProcesses.SelectedItems[0].Text, just have to figure out how to get it out of the third column
|
|
|
|
|
if you use listview, there is a Tag property that let you... hmm.. tag an object to an Item or SubItem.
You can just tag the pid string to Item's Tag, or you can tag a class containing the pid string + other stuffs to the tag.
So once you are able to get the SelectedItem, just take the object from Tag and that will be your pid.
Array array = listView1.SelectedItems;
if(array.Count>0)
{
for(int i=0; i
|
|
|
|
|
Ah that works brilliantly, cheers man
|
|
|
|
|
Hi,
I have extended a DataGridView class to add some custom event handling. I have a number of TextBox columns. I trap a Key Event and put a specific column into Edit mode. However, after the user completes their update and presses "Enter", I need to direct the focus to a new cell. By default the EndEdit call seems to move directly to the cell below. How do I override this?
I need to move the focus to another cell in the same row. Does anyone have a code snippet?
|
|
|
|
|
I am using MS Visual C# 2003 with Net 1.1. I can't seem to figure out how to compile code on multiple files without compiler complaints. What am I doing wrong? Thanks ahead o' time.
From Morse code... to DNA. All the universe is code.
|
|
|
|
|
What do you currently have in the seperate file? What compile errors are you getting?
Wacky waving inflateable arm flailing tube man!
- Family Guy
|
|
|
|
|
Thanks for getting back so soon, Sean! I've tried with namespace and classes from the first Form1 file. No matter how I arrange them or no matter what I try, I get compiler complaints.
From Morse code... to DNA. All the universe is code.
|
|
|
|
|
I'm not sure what errors your getting but here is an example of using a seperate file:
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
SeperateFile.PrintMessage("Hi n' Stuff");
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class SeperateFile
{
public static void PrintMessage(string message)
{
Console.WriteLine(message);
}
}
}
The example above assumes that the methods in your seperate file are static. If they are not you need to instantane the SeperateFile class:
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
SeperateFile obj = new SeperateFile();
obj.PrintMessage("Hi n' Stuff");
}
}
}
Does this help?
Wacky waving inflateable arm flailing tube man!
- Family Guy
|
|
|
|
|
Excellent! It's getting late here in California. I'll work with what you have given me tomorrow. Thanks again! You have been very helpful.
From Morse code... to DNA. All the universe is code.
|
|
|
|
|
I think I see my prob. Like you said... instantiate. That should do it, I think. I'll try tomorrow. Best Regards.... Mike
From Morse code... to DNA. All the universe is code.
|
|
|
|
|
I created a program which has a "Load Picture" button, and a Picture Box .Whenever I click a "Load Picture" button, it will show a Open File Dialog then selected file will load to a picture box.
My question is How I can make the picture loads to my Picture Box when User right click on a image file ---> Open With --> browse for my program.
Like Photoshop, you know, when you rigt click a image file ---> Open With ---> Photoshop --> then Photoshop will open with that image file.
Thanks !
|
|
|
|
|
When Windows tries to open a file with your application, it's simply calling your executable with the file path as an argument.
It's basically the same as dropping a file on your executable in a windows explorer window.
So you just have to handle the arguments you get at startup in your Main method.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
thank you so much .....! I understood and tried it ! Worked perfectly ... !
|
|
|
|
|
Hi,
I have a startPrint method that sends a String to a printer to print, this method was called my many threads many time within a short period, and the following exceptions occurs,
System.ComponentModel.Win32Exception: The handle is invalid
at System.Drawing.Printing.StandardPrintController.OnEndPrint(PrintDocument document, PrintEventArgs e)
at System.Windows.Forms.PrintControllerWithStatusDialog.OnEndPrint(PrintDocument document, PrintEventArgs e)
at System.Drawing.Printing.PrintController.Print(PrintDocument document)
at System.Drawing.Printing.PrintDocument.Print()
at VWServer.PrintObject.startPrint(String PrintingString, String PrinterName)
is there a way to fix this such that .NET is able to handle the large amoung of printing?
Thanks alot
|
|
|
|
|
Can I get rid of the class modifier 'S' in the following?
public class S {
public static string MyMethod( args ) { // foo }
}
public class C {
string s_answer;
s_answer = S.MyMethod( "bar" ); // how can I just write MyMethod()
}
Can I use a 'using' statement or some other directive?
Thx.
|
|
|
|
|
nyc_user wrote: Can I use a 'using' statement or some other directive?
No. In static methods you need to provide a class name where they belong to.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Unless, of course, you are calling it from within the same class the static is defined. (Sorry, I'm in a pedantic mood)
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
Colin Angus Mackay wrote: you are calling it from within the same class the static is defined.
Or a nested class or an inherited class
|
|
|
|
|
Hi,
I would like to know an elegant way to correct smaller errors in a xml document when reading it f.e. when a tag is <Hellu> instead of <Hello> as it should be.
Thanks in advance
-- modified at 16:19 Saturday 25th February, 2006
|
|
|
|
|
im using like this
string hostadi = Dns.GetHostName();
label1.Text = "Host Name :" + hostadi;
IPHostEntry local = Dns.GetHostByName(hostadi);
foreach (IPAddress ipaddress in local.AddressList)
{
label2.Text = "IPAddress = " + ipaddress.ToString();
}
its working but
it found my network ip =192.168.1.15
how can i find my real ip
thanks for help;)
|
|
|
|
|
Then you have to use an external source. As you are behind a firewall or router, you can't see the external IP address unless you send something outside of your local net.
www.whatismyip.com[^] is one of the pages that will show your external ip address.
If your router has an adminitrator interface, you can see the external IP adress there.
---
b { font-weight: normal; }
|
|
|
|
|
What I have done in the past is write a webservice that I host somewhere outside my network, and have my application call it.
Once in the webservice, it's trivial to find the IP from the caller (your network IP as seen from outside of it).
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
|
There are so many articles on this site I have no idea what to exactly look for. Here's my scenario...
I need to read approx. 15,000 files in a program and do extensive calculations on each file. Running the job single threadded will take many hours. I was considering a multithreadding application. I thought one way to accomplish this was to run the program by processing something like 10 files at a time using threads.
How could I accomplish this? If you could tell me or point me to one of these hundreds of articles, I'd certainly appreciate it.
|
|
|
|
|
What you want is a ThreadPool . By default it handles up to 25 Threads for you, but you can change the number. But don't use too many threads at a time or the thread switiching overhead will be greater than the performance you might gain by using many threads.
Check this example over at MSDN.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|