|
R@vuri wrote: can u plz anybody give me the code........
The dreaded text speech asking for code
Look here[^] before posting questions.
In addition, please don't use text speech, write full sentences.
thanks.
V.
|
|
|
|
|
Hi,
If u select the check box like(gmail,yahoo),all the check boxes selected..........
can u anybody plz give me the code
R@vuri
|
|
|
|
|
try this javascript function
function SelectAll(cntrl,grd,indCat)
{
var grdComp = document.getElementById(grd);
if(indCat == '1')
{
for(i=1;i<=grdComp.getElementsByTagName('input').length-1;i++)
{
grdComp.getElementsByTagName('input')[i].checked = cntrl.checked;
}
}
else if(indCat == '2')
{
var chkInd = true;
for(i=1;i<=grdComp.getElementsByTagName('input').length-1;i++)
{
if(grdComp.getElementsByTagName('input')[i].checked == false)
{
chkInd = false;
}
}
grdComp.getElementsByTagName('input')[0].checked = chkInd;
}
}
hope this helps
with regards
Karthik Harve
|
|
|
|
|
|
The simplest solution is to run a loop through the checkboxes and then check / uncheck them.
There are other more complex solutions like using LINQ etc.
Try one that suites you best.
|
|
|
|
|
I had a MDI WinForm Program, when click from a menu item, I new a new child WinForm(this child WinForm designed in the designer), but this new child WinForm is not maximumed even I set the childForm.WindowState = System.Windows.Forms.FormWindowState.Maximized;
Could you show me how to do this? Thanks in advance!
|
|
|
|
|
if you want this child to be open as a separate maximized form then try this below code..
CHildForm frm = new CHildForm();
frm.WindowState=FormWindowState.Maximized;
frm.ShowDialog();
[or]
if you want this child to be open as maximized within the MDI parent, then try this..
CHildForm frm = new CHildForm();
frm.WindowState=FormWindowState.Maximized;
frm.Show();
hope this hepls.
with regards
Karthik Harve
|
|
|
|
|
Actually, I am doing this, this doesn't work. Maybe some property I've set wrong?
|
|
|
|
|
Gentleman,
I am using a list box to list some string information gathered from an MSSQL database. I noticed that if I select the box and should "miss" the string line (selecting empty space), a null exception is thrown. The problem is that it also closes the application. I have tried several different ways to escape this by showing the exception (try, catch) and trying to return to the application, but they have all failed. Ideas?
Thank You, Pat
|
|
|
|
|
You say that an exception causes your program to close. This is normal.
You must show what code you're using in the selection event handler to get any real help with this.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
A lot of Controls, including System.Windows.Forms.ListBox will fire unexpected events, forcing you to code defensively. As an example, a SelectionChanged event (or whatever it is called) may be fired when an item gets deselected, which you can check by looking for a negative SelectedIndex, or a SelectedItem being null. If you don't, you're bound to run into trouble.
Also don't be surprised it you use OwnerDraw mode and get MeasureItem/DrawItem events with an index of -1.
IMO all these can be avoided by proper testing before acting; and all can be caught with proper try-catch constructs.
Finally, without actual code, we can't provide more specific help. I have noticed you seldom provide code when in fact you should.
|
|
|
|
|
Thank you Luc (nice of you to reply to me again) and to all of you in fact for your excellent replies. All are good advice and I intent to use it all. Re: The Issue; most of the time, I usually find myself embarrassed when I finally solve some of these things. I employed the following simple one line of code in the SelectedIndexChanged event to resolve the issue:
private void listBoxXxx_SelectedIndexChanged(object sender, EventArgs e)
{
if (listBoxXxx.Items.Count < 1)
{
string msg = "There are no Items in the list to select from. ";
MessageBox.Show(msg, "Required Information Missing", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (listBoxXxx.SelectedIndex != -1)
{
labelXxx.Text = listBoxXxx.SelectedItem.ToString();
}
}
To my friend and mentor Luc...actually, I looked up my history and I usually do supply the code when the issue is code failure but not when (I don't know how) which is sometimes the case. In this case, I should have supplied the following, but it was so basic I could not understand the possible link, so please accept my apology.
frmMain m = new frmMain(fname, title, firm, firmId, permission, theDate, userId, chal, CONNSTR);
this.Hide();
m.ShowDialog();
}
}
catch (SqlException Sqlex)
{
MessageBox.Show("Error: " + Sqlex, "SQL Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (Exception ex)
{
MessageBox.Show("Error: " + ex, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
Most important...thank you all for your interest and expertise. Luc, your answer was closest to what I used and I am marking it as the correct solution. Best Regards, Pat
|
|
|
|
|
My guess is you're doing SelectedItem.something in the event handler. If you select nothing, SelectedItem will be null, and SelectedIndex will be -1. You should always check for these conditions in any event handler that uses one of these properties; I typically put a guard at the top, since you usually don't want to do anything in that case:
void ListSelectionChanged(object sender, EventArgs e){
ListControl list = (ListControl)sender;
if(list.SelectedIndex < 0) return;
...
}
|
|
|
|
|
Has anyone ever developed a com class to allow data to be extracted from MT4 platform? I have developed a TCP/IP wrapper class which works great, but MT4 does not seem to allow multiple TCP/IP sessions!?
I see this (http://www.mql5.com/en/articles/249[^]) article online, has anyone have any experience with this? Its supposed to work for MT4 as well.
Mike
|
|
|
|
|
Hello , I'm learning English. My English is low.
My question is : I have two keyboards in my pc. I was studing this article from Using Raw Input from C# to handle multiple keyboards[^] from Emma Burrows. I understan the article.
Now I can identify any keyboard, for example : Keyboard 1 is A, Keyboard 2 is B.
In my aplicacion that I'm doing in C#, I use two keyboards, A and B, if I press any key from keyboard A, my program say : Hello Word. If I press any key from Keyboard B, my program say : Bye ! World! . This is in my program.
My question is : I want isolate keyboard B, the keyboard B must exist only for my program, for example, if I want write in notepad when my aplication is running with keyboard B, this must be imposible because I want use keyboard A and B ONLY in my program , but I want write with keyboard A in notepad, I must can it. I must write in others programs only with keyboard A.
The keyboard B must not exist for other aplications. Only must exist the Keyboard A for the aplications , but my program work with keyboard A and B.
This is because I'm using a barcode gun, for windows it is a keyboard. If you are writing a e-mail and I use the barcode gun, you can see numbers in you email when you are writing. I want avoid that.
If you are writing with keyboard A a e-mail and I use the barcode gun or keyboard B, Windows must ignore the codebar gun.
Ok, I hope do you understand me.
|
|
|
|
|
You picked the wrong hardware for this requirement. You're using a USB barcode scanner running as a HID device. That, as you've found, runs as a keyboard to Windows. Had you picked either a serial- or network-based scanner, you wouldn't have to write a single line of code to satisfy your requirement. The scanner won't show up as a keyboard.
Now, since you've picked the wrong hardware interface, you have to spend an awful lot of time writing code to get around this problem. The only way to do that now is to write an application that is essentially a global keyboard hook.
You'd be using the same code that you used from the example article in an application that, instead of processing the key and using it, eats the key and doesn't pass it on to the system.
|
|
|
|
|
Hello Dave. My problem is: I have a small gym. I'm doing a program of access control. I have a computer. I use this computer to listen music, write a letter, navigate in internet ... anything.
When a new user is in my gym, I want print a card with : photo's user , Name's user and a barcode user. When the new user come to my gym, He only must pass the card with her codenumber in the scanner barcode.
You imagine: If I'm writing in FireFox www.anypage...., or writing in word... and in that moment, a user pass her card from codebar scanner , I can see www.goo4748383747 , and I have will delete the numbers.
Therefore I want isolate the codebar scanner of Operative system. Do you have any information about globals hooks?
Thanks !!!
|
|
|
|
|
OK. Your explanation of what's going on justifies my response. YOU ARE GROSSLY OVER ENGINEERING THIS!!
Scrap the USB scanner and get one with a serial interface. DONE! Your code is up and running practically in a day.
Your app only has to watch the COM port for data to come over it and then process as normal. No screwing around with split keyboards at all!
|
|
|
|
|
I do not want to be stubborn.
Hello Dave,I forget say you this: I have a new computer. My computer have not COM PORT , only USB. Nowadays, all computers have only USB , for any companies COM PORT is obsolete.
Therefore I'm searching information about that. If is very dificult, I need a old computer with COM PORT.
¿Can you help me? Thanks.
|
|
|
|
|
|
Yeah, get a USB to Serial converter cable.
BTW, it's Parallel ports that are obsolete. Machines and motherboards are still coming with Serial ports.
|
|
|
|
|
thanks !! I will think this option !!! Thanks Dave.
|
|
|
|
|
tsw1985 wrote: This is because I'm using a barcode gun, for windows it is a keyboard. If you
are writing a e-mail and I use the barcode gun, you can see numbers in you email
when you are writing. I want avoid that.
That doesn't sound like a real business requirement.
Hypothetically...
This is a cash register app that allows it to scan items, issues receipts and can also send email to other stores.
Now if the clerk is typing an email why would they pick up the scanner and use it?
Conversely what if the clerk wants to send the email and then put the scan code in the email...so they write some text, scan a product (which puts the code in the email) and then they write some more.
So in the one case you have a scenario that just will not happen. And then you 'fix' it. And that completely precludes the second scenario.
|
|
|
|
|
After reading your post and the replies, my recommendation is to buy a second computer (even something as simple as a Fit-PC or a Plug PC) to run the app. It could then interact with the main PC via a Web Service or something.
|
|
|
|
|
Hi every one! I want to know how to send sms using GSM modem. i mean connecting a 3G enabled mobile phone in to our computer through USB and sending SMS using C# application. advance thanks for all!!! please help me.
|
|
|
|
|