|
Just gave it a try, and you're right - it didn't work. At least, not in the KeyUp event. The KeyDown-event did the trick;
private void comboBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Down)
{
e.Handled = true;
comboBox2.Focus();
}
}
Enjoy
I are troll
|
|
|
|
|
thank's !!!!!
|
|
|
|
|
I are troll
|
|
|
|
|
I'm inheriting Process class and add some of my own methods but there is a problem that is preventing me to do so...
public class XProcess : Process
{
public bool GetProc(string name)
{
Process[] tp = Process.GetProcessesByName(name);
if (tp.Length == 1)
this = tp[0]; <<< Error : Cannot assign to '<this>' because it is read-only
else
return false;
return true;
}
}</this>
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)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
You can't assign to "this" as you correctly noticed, but you can return a new instance from your method;
public class XProcess : Process
{
public XProcess GetProc(string name)
{
Process[] tp = Process.GetProcessesByName(name);
if (tp.Length == 1)
return tp[0];
return null;
}
}
Hope this helps
I are troll
|
|
|
|
|
ahm...I do not want to create a new instance, I just want to set the currect instance.
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)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
You can't recreate yourself, since you already exist. I guess the best bet is to clone yourself and dispose of your original self
I are troll
|
|
|
|
|
Hi,
by creating an instance of class Process, you do not create a Windows process, you create an object that represents a new or an existing Windows process.
GetProcessesByName, GetProcessByID and the like create zero or more Process instances and zero processes;
the Process instances contain information about the Windows processes.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Sunday, June 12, 2011 8:11 AM
|
|
|
|
|
yes thats why I made it static method now.
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)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi,
yes it should be static, it is not using any instance members of the XProcess class.
Two comments:
1.
if that happens to be the only method in the class, no need to inherit from Process.
2.
what do you want to happen when two or more processes exist by that name? at the moment (i.e. the last code shown) you get none of them...
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Sunday, June 12, 2011 8:12 AM
|
|
|
|
|
This is what I'm using
public static XProcess GetProcessByName(string name)
{
Process[] tp = Process.GetProcessesByName(name);
if (tp.Length == 0)
return null;
else
return (XProcess)tp[0];
}
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)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
modified on Tuesday, February 17, 2009 1:09 AM
|
|
|
|
|
Does that compile?
tp[0] is a Process but not an XProcess, so the method does not return the type its declaration promised.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
opppss i copied old one, corrected now
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)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Sunday, June 12, 2011 8:12 AM
|
|
|
|
|
HAHAHA http://www.codeproject.com/script/Forums/View.aspx?fid=1649&msg=2927732
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)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I'm using The COM component wmp.dll but when I add the component I cant see the pause,stop,volume etc. buttons. Can you help me about it?
Thanks in advance.
|
|
|
|
|
These are the relevent lines from the code. The same file is being opened, the problem is that the program can't find the sheet when running under XPPRo, 2003 server, or Vista Business. All computers are up to date with the latest .net installed, all have Excel 2003 with current updates. Any ideas?
string listname = "Sheet1";
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename + ";Extended Properties=Excel 8.0");
con.Open();
try
{
DataSet myDataSet = new DataSet();
OleDbDataAdapter myCommand = new OleDbDataAdapter(" SELECT * FROM [" + listname + "$]", con);
myCommand.Fill(myDataSet);
All Systems have Excel 2003 SP3
I get an error message on the failures:
System.Data.OleDbException: The Microsoft Jet database engine could not find the object 'Sheet1$'
modified on Tuesday, February 17, 2009 12:14 PM
|
|
|
|
|
Try using this as a connection string instead
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename + ";Extended Properties = 'Excel 8.0;HDR=Yes;IMEX=1'";
I am going with the presumption that "filename" is an actual path and "Sheet1" does exist in all cases....
butyou know what they say about presumptions
|
|
|
|
|
You are correct. Filename is a variable holding the full path of the actual file, and sheet1 does exist in all cases, as in each instance, I have copied the file from one to another.
What is the "IMEX=1" all about?
|
|
|
|
|
Darn! Still no good. It makes no sense to me. Why fine on one but not on others?
I used to say that I liked programming because of the instant gratification when you compile an app and it works, but this is an example of the dark counterpoint to that. Instant frustration.
|
|
|
|
|
HDR=Yes; Indicates that there are header rows in the sheet,
and IMEX=1; 0 Export mode, 1 Import mode, 2 Linked mode,
I run Imports from excel in 98/XP/Vista with that connection and its all good.
How are you defining your path ie:Filename??
|
|
|
|
|
This is all the relevant code. I just don't get why it would work for the one system but not the others.
string filename = "C:\\Program files\\Daily_Totals_By_Employee.xls";
string listname = "Sheet1";
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename + ";Extended Properties = 'Excel 8.0'");
con.Open();
try
{
DataSet myDataSet = new DataSet();
OleDbDataAdapter myCommand = new OleDbDataAdapter(" SELECT * FROM [" + listname + "$]", con);
myCommand.Fill(myDataSet);
con.Close();
|
|
|
|
|
I would try to put the file in a location like "C:\\Myfolder" just to test
eliminate the "Program files" directory and see what happens, also punch in the path manually
Data Source= C:\Myfolder\Daily_Totals_By_Employee.xls
See if any of those work...sorry I can't be any more specific...
|
|
|
|
|
I just tried the path suggestion. I changed the path to
"C:\\csharpdata\\Daily_Totals_By_Employee.xls".
No change.
At the risk of being obtuse, I don't understand how permissions could be the problem. I'm not saying you're all wrong, just that I don't understand it. The file is being opened: wouldn't a permissions issue prevent that? The program opens the file then fails to find the sheet.
|
|
|
|
|
Hi all
I'm a dev newbie and am struggling to get my listbox to work they way i want it to. Basically, i want to be able to store the results of my stored procedure within a listbox control - so for example, if my sproc returns ServerID (primarykey) and ServerName (text column), i want this bound to my listbox control.
In my app i have created a datareader which contains the results of my query. As i loop through the datareader, i want to bind my ServerID and ServerName values to the listbox.
At the moment, I can get ServerName to display in my listbox by implementing the following:
listbox.items.add(System.Convert.ToString(reader[1]));
I then assume i need the following code to assign my query results to the displaymember and valuemember properties:
lbServerList.DisplayMember = reader[1].ToString();
lbServerList.ValueMember = reader[0].ToString();
Now i want to be able to select a server from my drop down list, and get the associated serverid. So for testing purposes, i've created a button and when i click the button, i want the serverid corresponding to the selected servername in my listbox, to be written to a textbox:
if (lbServerList.ValueMember != null)
{
textBox.Text = listbox.ValueMember;
}
A number is indeed written to the textbox but it is a random number which doesn't link to the selected servername, and the number doesn't change no matter what server i select.
Can someone please help fill the gaps in my understanding???
I need to know first whether i'm populating the listbox correctly, and then secondly how to retrieve my serverid from it.
Thanks!
Di
|
|
|
|