|
have a look at the System.Reflection namespace.
There are several articles about reflection here on CP.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- 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 PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
you actually understood what was meant? what was it?
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
"There is no wealth like knowledge, no poverty like ignorance." Ali ibn Abi Talib
"Animadvertistine, ubicumque stes, fumum recta in faciem ferri?"
|
|
|
|
|
the question was: "If I have the name of an existing field/method/property in a string,
how can I access that particular field/method/property?"
or something completely different.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- 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 PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
ah! Well, I'm glad you were able to understand what was wanted, because I sure didn't!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
"There is no wealth like knowledge, no poverty like ignorance." Ali ibn Abi Talib
"Animadvertistine, ubicumque stes, fumum recta in faciem ferri?"
|
|
|
|
|
I have added a DataReceived event to COM3 (the IrDA port) on my PPC. However, this event is never fired. If I use a short Sleep function and then do a Read, the expected data is there. Does anyone have an idea of what is wrong here? My code follows.
public partial class Form1 : Form
{
private SerialPort m_gIrDA;
private Byte[] sendbuf;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
void m_gIrDA_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
MessageBox.Show("This never happens");
}
private void button1_Click(object sender, EventArgs e)
{
try
{
if (m_gIrDA != null)
{
m_gIrDA.Close();
}
m_gIrDA = new SerialPort("COM3", // string portName,
57600, // baudRate
Parity.None,
8, // int dataBits,
StopBits.One);
m_gIrDA.Handshake = Handshake.RequestToSend;
m_gIrDA.ReceivedBytesThreshold = 3;
m_gIrDA.DataReceived += new SerialDataReceivedEventHandler(m_gIrDA_DataReceived);
m_gIrDA.DtrEnable = true;
m_gIrDA.Handshake = Handshake.RequestToSend;
m_gIrDA.Open();
sendbuf = new byte[10];
sendbuf[0] = 0x0a;
sendbuf[1] = 0x00;
sendbuf[2] = 0x01;
sendbuf[3] = 0x20;
sendbuf[4] = 0x35;
sendbuf[5] = 0x38;
sendbuf[6] = 0x30;
sendbuf[7] = 0x30;
sendbuf[8] = 0xf9;
sendbuf[9] = 0xec;
m_gIrDA.Write(sendbuf, 0, 10);
}
catch (System.IO.IOException)
{
m_gIrDA.Close();
MessageBox.Show("IOException");
}
}
}
Steven L Berntsen
Montreal QC Canada
sberntsen@kim.kaba.com
|
|
|
|
|
Hi,
i like to know how can i know if the table exsits in a "FILE".mdb
using Odbc or OleDb.
THNKS
Have Fun
Never forget it
|
|
|
|
|
simplest way is to use the table name in select statement and catch the exception for FILE DOES NOT EXIST...
-----
|
|
|
|
|
THANKS, i Figured It Out
But THANKS For Answering
Have Fun
Never forget it
|
|
|
|
|
NotifyIcon Click Problem
I setup my NotifyIcon named "sysTray" as
<br />
class MainForm : Form<br />
{<br />
void setUpTrayIcon()<br />
{<br />
sysTray.Icon = Icon.ExtractAssociatedIcon("App.ico");<br />
<br />
this.Shown += delegate(object o, EventArgs ev)<br />
{<br />
sysTray.Visible = true;<br />
};<br />
sysTray.Click += new EventHandler(doSysClick);<br />
<br />
MenuItem[] itm = {new MenuItem("Prev", new EventHandler(doPrev)),<br />
new MenuItem("Next",new EventHandler(doNext)),<br />
new MenuItem("Stop", new EventHandler(doStop))};<br />
this.trayMenu = new ContextMenu(itm);<br />
<br />
sysTray.ContextMenu = this.trayMenu;<br />
}<br />
}<br />
The Icon showsup correctly in System Tray Area. When I Right Click on it the Menu also shows up. But once the Menu is Poped Up then It does not matter if I click on the Menu or My App's Tray Icon the sysTray.Click Item still gets Fired and my EventHandler, doSysClick is called.
What I expect is that Only when I click on the App Icon in the System Tray should my doSysClick method be called.
If My System Tray Menu is Visible then if I click anywhere outside it, then it should just hide itself (that is the usual behaviour).
So what am I missing?
Thanks...
|
|
|
|
|
Use the MouseClick, MouseDoubleClick etc... events instead of the general click event.
|
|
|
|
|
the Pronblem is i have a table of employeeinfo having attribuyes
EmpID
EmpName
EmpFatherName
GenID
now GenID is a primary key of a separate table having two attributes that is
GenID
Gender
the problem is when the form runs displaying 3 textboxes and one combobox the user must select the entry from gender and click save the values must be stored in the table of sql that is Employeeinfo i saved the first three attributes by the following code
datarow.["EmpID"] = EmpID.text;
but on GenID it gives problem bcoz i want to relate the Gender attribute to the GenID Attribute in the EmployeeInfo table and must be saved in the sql data table
|
|
|
|
|
You asked the same question only a few minutes ago? Why have you posted it again?
Don't you know that this is rude?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Posting the same question minutes apart is not going to get it answered any faster. That is rude.
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Hi! All
I 've a storeprocedure that insert data into a table and return current id of that. record is succefully inserted but i couldnnot get that id, so how do i. any suggestion regarding this will be anticipated.
Bye.
id is not output paramater but it is return with 'return' keyword by store procedure.
-- modified at 11:09 Friday 23rd November, 2007
|
|
|
|
|
|
the Pronblem is i have a table of employeeinfo having attribuyes
EmpID
EmpName
EmpFatherName
GenID
now GenID is a primary key of a separate table having two attributes that is
GenID
Gender
the problem is when the form runs displaying 3 textboxes and one combobox the user must select the entry from gender and click save the values must be stored in the table of sql that is Employeeinfo i saved the first three attributes by the following code
datarow.["EmpID"] = EmpID.text;
but on GenID it gives problem bcoz i want to relate the Gender attribute to the GenID Attribute in the EmployeeInfo table and must be saved in the sql data table
sas
|
|
|
|
|
Mr.Sajid
In ur case:
I suppose ur not populating combobox with from a table; that's why u r facing the problem.
Regards
|
|
|
|
|
hi all,
I'm new user and beginner programmer . I want to ask about the way that I can shut down the pc ? I mean what is the library and function or methods that can help me to do this ?
thanks
|
|
|
|
|
|
And an even easier way (assuming your using XP, and probably Vista, but who knows) is to use:
Process.Start("shutdown", "some arguments");
And the arguments are:
-i Display GUI interface, must be the first option
-l Log off (cannot be used with -m option)
-s Shutdown the computer
-r Shutdown and restart the computer
-a Abort a system shutdown
-m \\computername Remote computer to shutdown/restart/abort
-t xx Set timeout for shutdown to xx seconds
-c "comment" Shutdown comment (maximum of 127 characters)
-f Forces running applications to close without warning
so:
Process.Start("shutdown", "-s");
Would shut down the machine.
My current favourite word is: PIE!
Good ol' pie, it's been a while.
|
|
|
|
|
Hello everybody,
i added a column to my DataGridView with Buttons.
I created the EventHandler of CellEnter, ther'in i
like to delete this row.
The DataSource is an ArrayList of Classes which are displayed via his Members.
So if the user clicks the Delete-Button, the given record will be deleted in the database
and i refill the ArrayList with the new lines of the Database ( decreased by 1 row )
To refresh the DataGrid, i need to set the DataSource to null and re-set it to my ArrayList.
This works great in standard-functions, but not in this CellEnter-Event
I think i can't modify the DataSource of the grid because i'm into the handler of the grid.
Does anyone knows a solution?
In MFC i would make it via a PostMessage, that the code is executed after the EventHandler.
Big thanks
|
|
|
|
|
I'm trying to load an image from a file and then draw it. I found out the speed is quite unacceptable. This is the case especially when I want to render several images simultaneously using Image.FromFile() and Graphics.DrawImage() .
I wonder if there's any other way to improve the performance while rendering images?
|
|
|
|
|
That depends on how you're drawing the images, what the images are, how big they are, ... You haven't provided any useful details so it's pretty much impossible to tell you anything useful.
The quality of the answer you get is dictated by the quality of the question you ask.
|
|
|
|
|
Thank you.
What I wanna do is load all the pictures from a folder and display them all as thumbnails on a panel.
For example, I have a folder containing 50 pictures of size 3000 * 2000.
I used the Image.FromFile() to load all the pictures. And whenever a single picture was loaded, I used Graphics.DrawImage() to render it on the panel in no delay.
That's where the problem comes. The pictures came out at a incredibly low speed. Compared to Adobe Bridge, ACDSee or other softwares of that kind, I think although my algorithm may be inpropriate, there should be a better way to load and display images than using the .NET GDI+.
|
|
|
|
|
SeeBees wrote: For example, I have a folder containing 50 pictures of size 3000 * 2000.
No wonder... In order to generate the thumbnail, GDI is loads the entire file into memory then generates the thumbnail.
GDI+ is a generalized library, preferring compatibility over speed. If you want to improve performance, you'll need to find a third party graphics library that gives you the perfromance features you need. Figure out what your requirements are, then go shopping.
|
|
|
|