|
I've used wmi ever ,but the API called Win32_NetworkConnection don't fit my requirement.
or
[DllImport("wininet.dll", ExactSpelling=true, CharSet=CharSet.Ansi, SetLastError=true)]
private static extern bool InternetGetConnectedState(ref int lpSFlags, int dwReserved);
I only want to get the status the same as I mentioned from my question.
|
|
|
|
|
|
y u people r not answering my ques..or doubts..
i have added two buttons (ADD,UPDATE)
how to delete,update the selected records from grid view
|
|
|
|
|
|
i know thats basic ques..but i believe on the lessons taught by experienced guy ....so i m communicating like this....
jus now started my carrier as developer..
so dont mistake me
|
|
|
|
|
sorry,i didn't konw u r a beginner.
I suggest u'll find a tutorial book for beginner(publish by Apress).
I think u'd better buy that from a bookstore or Amazon.
Do more exercise and memorized the code from start.
Good luck!
|
|
|
|
|
But Jhon Simpson the Outlow programmer answeared your question.
Use
cmd.Parameters.AddWithValue("@name", name);
cmd.Parameters.Add("@name", name);
As a side note, in order to work your class should extend the abstract class
AbsDoDoubtlyNitro witch is exactly what's missing from the ISpanishInquistion contract specified by John
|
|
|
|
|
Mos Dan - Lucian wrote: Jhon Simpson the Outlow programmer
You should runaway and hide.
"No matter how many fish in the sea; it will be so empty without me." - From song "Without me" by Eminem
|
|
|
|
|
ya i 've fixed before i saw ur ans...
thanks a lot for responding me.....
|
|
|
|
|
Mos Dan - Lucian wrote:
But Jhon Simpson the Outlow programmer answeared your question.
Ummmm... you are risking death by spelling my name wrong.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: Mos Dan - Lucian wrote:
But Jhon Simpson the Outlow programmer answeared your question
I quite like the word answear. It's an answer, but R rated.
|
|
|
|
|
In the designer click on gridview, edit columns, and then add commandfields
|
|
|
|
|
hi all,
im new to the c# world..
there is some error showing on my test program..
it shows "InvalidCastException was unhandled by user code"..
using VS2008 pro to code..
wat is tat suppose to mean??
anyone can help me??
any help are deeply appreciated..
thank u..
best regards,
A.Kogulakannan
|
|
|
|
|
Well you have a value/variable that is trying to be converted into another datatype which is not allowed such as;
DateTime testValue = Convert.ToDateTime(23);
This will also cause an "InvalidCastException" if it is not handled in a try/catch block.
|
|
|
|
|
Hi,
you tried to cast an object which wasn't able to cast (maybe it is null). If you post the code, it could be possible that we spot the line...
Regards
Sebastian
|
|
|
|
|
object ICOSDriver.Document
{
get
{
//return null;
throw new NotImplementedException();// ==>> shows error here while debug.
}
}
thank u..
|
|
|
|
|
I guess returning a null value will fail by the code consuming the ICOSDriver.Document property. Where do you use the property?
|
|
|
|
|
public void ReadCard()
{
string s = string.Empty;
i_targetCOSDriver.CreateDocument();
targetSmartDoc = (ISmartCardDoc)i_targetCOSDriver.Document; //==>>here
if (targetSmartDoc == null)
return;
// Separate reading because the data fall in different Data Record Set
ReadMPPNo();
ReadICNo();
ReadPhoto();
ReadThumbData((int)PassportDataRecord.THUMB_1, (int)PassportDataRecord.THUMB_2); //Thumb1
cs_targetCOSDriver.Terminate();
}
|
|
|
|
|
So,
when you return null and try to cast the value explicit, the instruction
targetSmartDoc = (ISmartCardDoc)i_targetCOSDriver.Document;
will fail. I suggest that you should use the "as" instruction, which will work with null and cast failures without raising an exception.
targetSmartDoc = i_targetCOSDriver.Document as ISmartCardDoc;
That should work...
Regards
Sebastian
|
|
|
|
|
guess wat.. it works!! thanks a lot sebastian..
|
|
|
|
|
Hi all,
I'm writing what is essentially a kind of terminal emulator (for various reasons I can't use a pre-existing one, as this needs some pretty specific features).
One thing I'm a bit stuck on is trying to figure out how to make a custom control for the output text box. I need something that looks and acts somewhat like a textbox (however "read-only" from the user's perspective, as they enter commands in a separate control (or commands will be fired programmatically), and this control is just to show the output from the server.
The problem is, the "history". RichTextBoxes (and TextBoxes of course) have a maximum amount of characters. This is fine, and of course completely acceptable. However, when the control reaches it's maximum, I want it to behave in such a way that the oldest lines disappear from the start and the new lines come in at the end. As I will set the maximum length to be very long, doing this by taking ALL the text in the box, cutting the first line and then rewriting the whole lot in the text box again would be absolutely terrible for both memory usage and speed (i.e. totally unacceptable user experience). Such controls seem to be quite common for terminal emulators, telnet clients, MUD clients, custom consoles, etc, so I assume there should be some pretty nice examples out there, but I really can't find anything (every example of these types of apps I've come across seems to forget about this issue and doesn't handle what happens when the text box maximum is reached!)
It should ideally be derived from RichTextBox since I need colour support, however if it supports colour and looks somewhat like a text box, I'm happy to work with anything as I'll probably be modifying it heavily anyway. I'd also love it if it was entirely .NET managed code rather than making Windows specific calls since I intend my application to work under mono as well as on Windows... however if that's asking too much, I'll accept native Windows calls if that's what you suggest and then will come up with different methods for other platforms.
Any ideas?
|
|
|
|
|
I think you are probably going to end up producing your own custom control. You are right, the user experience for continually removing a line of text from a TextBox or RichTextBox would probably be horrible (depending on how many lines of text you allow.
If you didn't need colour, then a ListBox would probably help, and it has an Items collection which supports Add and Remove / RemoveAt. But no colour.
The custom control shouldn't be a major problem, just provide your own paint and use Graphics.MeasureString to get the height of the line - you can them support the size you want, in the colours you want.
All those who believe in psycho kinesis, raise my hand.
My 's gonna unleash hell on your ass. tastic!
|
|
|
|
|
The ListBox idea was one I considered (adding colour to that is actually pretty trivial), but then I'd have the problem that I do want the user to be able to select text and copy/paste it elsewhere, which is not really feasible with a ListBox.
For reference, I want to allow something like 20000 lines of "history" in the control (each line will be limited to 80 characters because of what I'm connecting to, so that's only approx 2MB of text even including the ANSI colour codes)
With regards to providing my own paint, I've always had performance issues with manually pasting strings on custom controls. Are there any hints around about doing this without severe performance degradation? And also, if I'm not using a TextBox as a base, how I might handle the select/copy/paste that a TextBox provides? It just seems like it might be quite a lot of work for something that ends up only very marginally different from a TextBox.
(of course if anyone else reading has a good idea for my original question, I probably don't need this part answered!)
|
|
|
|
|
Sorry, but I can't help you there - I assumed from your original post that "read-only from a users perspective" meant it did not include paste! As I have never tried to implement that you are better off getting help from someone who has.
Another option might be to look at existing Terminal emulators which it may be possible to modify to your needs (ie rip out the serial port bit) as these would include some colour control, probably via ANSI escape sequences. Never tried them, but I know they do exist in commercial and open source variants.
All those who believe in psycho kinesis, raise my hand.
My 's gonna unleash hell on your ass. tastic!
|
|
|
|
|
Yep, no problem. Thanks for your help anyway.
Just to note: I am not actually wanting to implement paste - just select and copy (over multiple lines or only parts of lines, as with a TextBox)... sorry if the mention of paste added confusion.
As mentioned, looking at existing Terminal Emulators, I can't find anyone that's even considered this. They tend to use a standard RichTextBox and there's nothing in there to handle what happens when it flows over the character limit (I assume that if they've even thought about it, they just think it's unlikely to ever happen - with a limit of 2147483647 chars, it works out to a few months at 10 lines per second with 100 chars per line (maybe I'm just being fussy by worrying about it?) (actually, I still don't know what behaviour to expect when it overflows... if you set a MaxLength manually, it's ignored for programmatic input - it only stops manual input after that amount))
Regarding ANSI colour - I've already written all that myself. The current version of my app uses a RichTextBox (as with everything else I've seen), so it's not holding up my development work - I just want to avoid possible future problems.
|
|
|
|