|
If you need to, you can write your own event arguments simply by writing a class that derives from System.EventArgs.
However, you wouldn't be able to raise the event with your new arguments unless you inherit from the TextBox class and raise it yourself with your own arguments.
Here is a common handler for both:
this.yearBuiltTextBox.Enter += new EventHandler(Parse_TextBox);
this.yearRenovateTextBox.Enter += new EventHandler(Parse_TextBox);
void ParseTextBox(object sender, EventArgs e)
{
TextBox tbSender = (TextBox)sender;
if(sender.Enabled == false)
{
return;
}
int min, max;
if(tbSender == this.yearBuiltTextBox)
{
min = 1800;
max = 2200;
}
else
{
min = 2400;
max = 2800;
}
object parseValue = DataFormatter.ParseInteger(this.yearBuiltTextBox.Text, min, max);
}
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuality in Christianity
Judah Himango
|
|
|
|
|
Judah Himango wrote:
if(sender.Enabled == false)
object doesnt have an enabled property, so the above quoted line should have read
if(tbSender.Enabled == false)
or
if(!tbSender.Enabled)
|
|
|
|
|
hello
I have a datagrid which consists of two columns, one templatecolumn and one boundcolumn. the templatecolumn's got two checkboxes, one in the header (when pressed it checks all checkboxes) and one for every row.
the boundcolumn shows data from a datatable. when I press a button I want to check which of the checkboxes are checked, and for everone that is, get the datakey for that row and put it in an array.
to accomplish this I do
<br />
CheckBox cb;<br />
int i = 0;<br />
foreach( DataGridItem dgi in this.MyDataGrid.Items ) <br />
{<br />
cb = (CheckBox) dgi.Cells[0].Controls[1];<br />
if ( cb != null && cb.Checked ) <br />
{<br />
id = (int) MyDataGrid.DataKeys[i];<br />
alSelectedValues.Add(id.ToString());<br />
} <br />
i++;<br />
}<br />
but when I run program I get "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index "
can anyone see whats wrong?
/Regards Magnus
|
|
|
|
|
Hi All,
I want to know how to use Pessimistic locking inside code in the multiuser invironment urgant
|
|
|
|
|
You've just asked a very vague question. You want to use pessimistic locking of WHAT? What database, table, block, record, ... ? What DBMS are you using?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello all ,
Im new to dot net programming and want to develop a Client-Server app over a wireless medium preferably 802.11g . I need to know what libraries to use . Is it Winsock , and if so wat port does it use to listen connections.
I'll appreciate a prompt reply..
|
|
|
|
|
It's no different than any other wired network application. Your application shouldn't care what the network medium is anyway.
There is no specific port to use on wireless compared to anything else. TCP ports work not matter what the network medium is. The port you use in your app is entirely up to you, though, I would suggest not using a port number below 1024.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanx dave , i'll post if i hav more questions
|
|
|
|
|
Hello
I am learning crystal reports. I dont know how to use functions listed in formula editor. If any body knows plz help me.
Regards
Asmyan
|
|
|
|
|
I am tasked with creating a Windows service that acts as a process manager for several applications. the service must start, monitor and restart these applications. i've just created a basic service using C# and it installs and starts fine. i have a small piece of code to spawn a thread and start a process. the service executes this fine and the process starts, but there's no GUI. for instance, i tested it with notepad.exe. when i start my service, i see notepad.exe in Task Manager, but there's no notepad window on the screen. are Windows services limited in this regard? can i not start a program that has a GUI from a windows service?
thanks,
b
|
|
|
|
|
Your service is running under the Local System account (by default) and is not tagged as "Allow interaction with desktop". Go into the Service control panel, get properties on your service, click on the LogOn tab and you'll find what you're looking for.
By default, services run on their own desktop, not the visible one the user sees.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thanks for the quick response. i have tested setting this option, and it works fine. i already had in code to use the Local System account. is there a way to set, programmatically, the "Allow interaction with desktop" flag? i can't find any C# documentation on it (though i did find some with C++)
|
|
|
|
|
There is no support for setting it in the Service Installer. You kind of have to hack it into the installer. See this[^] post by Heath Stewert for more information.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a panel that I am drawing lines and text on. I can also drag and drop other panels onto this panel. When I save it to an image like this:
<br />
DialogResult dr = sfdImage.ShowDialog();<br />
if (dr != DialogResult.OK) return false;<br />
Image img = pnlDrawBoard1.getImage();<br />
img.Save(sfdImage.FileName);<br />
I only get the graphichs that I have drawn on the mother panel. How can I save everything that is on that drawing panel including the panels in it as a JPEG?
- Atle
|
|
|
|
|
There is a application using directinput. I can't send keys with 'keybd_event', 'sendkey' ..etc.
How can I send keys to this application?
I cannot find any hints...
I think it's very difficult question.
Please let me know the answer.
|
|
|
|
|
DirectInput is part of the DriectX gaming SDK. It doesn't use the events like Windows does with normal forms. So you can't use SendKeys with it.
I don't know if this will work, but, in theory, you'd have to generate keyboard messages from inside a low-level keyboard hook. These messages would have to duplicate the key make and break messages that normally come out of the keyboard driver.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
a little confusion here from a c++ standpoint ... the positioning of a class around main? would you explain ... where (or must I) put all my classes,structs,static functions,etc. all within a sortof ghost class that encompasses 'main'... I'm running into alot of conflict with the complier not recognizing 'stuff' ... obviuosly I'm new to C# ... a quick consice explanation would be much appreciated.
Tommy
|
|
|
|
|
Unlike C++, C# requires that all functions be inside a class. So your Main method should be declared as a static member of a class.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I have an application that is to read data from a device, parse it and write in an SQL database table as records. The application is in c#.
An average of 8000 records are inserted into the table during every download from the device, and each record is 8 fields long, each field a few bytes (nothing big or complicated, just char and datetime fields).
I wonder how I can best perform the write in the database....should I use datasets or direct access? If datasets, is it better to load the whole table in memory and do an update at the end or fill the dataset, insert and update everytime a record is written?
I am shooting for performance and resource conservation.
Thanks
Chris
|
|
|
|
|
I think 8000 records is too heavy for the DataSets
Please check out
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/bdadotnetarch031.asp
I would rather suggest you to create the insert statements programatically instead of relying on DataSets. The send the insert query to the database in batches.
It would increase the performance a lot.
Thanks,
Alomgir
|
|
|
|
|
create all the inserts and then release them as one block .
(put a ';' behind each insert)
that's how we do it
good luck.
No hurries, no worries.
|
|
|
|
|
I will try this idea and compare it with the insert statement everytime a record is received. Thanks a lot for this!
|
|
|
|
|
Hi all,
when I read the materials of c#, I have some questions about the class inheritance.
Let's say a method is declared as private in a base class (class A). If a child class (class B) is derived from class A, can the private method be inherited to class B?
for example,
class A
{
private myMethod()
{
}
}
class B : A
{
}
When an instance of class B is created, does it have the method "myMethod()"?
OR it has the method, but cannot access it?
I am confused by the phase "inherited class cannot ACCESS private method of the base class"
Thanks~~
|
|
|
|
|
Hi,
myMethod() WILL BE be inherited by class B. But since myMethod is marked as private, it cannnot be accessed within Class B.
rgds
pradeep TP
|
|
|
|
|
tttyip wrote:
When an instance of class B is created, does it have the method "myMethod()"?
What exactly do you mean by that? Most common object layouts doesn't include methods in them.
In any case, myMethod will exist at runtime, but the compiler disallows access to it when called on an instance of B.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|