|
I want to add a hotkey (for e.g. <crtl> + t) to focus one of my TextBoxes im my From. How to do that?
_____________________________
...and justice for all
APe
|
|
|
|
|
The easiest way is the HTML accesskey[^] attribute.
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message".
|
|
|
|
|
Either put a Label with the according shortcut in front of your TextBox (with respect to tab order) or set KeyPreview to true for the Form and handle key presses yourself.
In that case you can use the TextBox.Select() method.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Ok, now i've tried this:
private void VSAddressRegisterForm_KeyPress(object sender, KeyPressEventArgs e)<br />
{<br />
Keyboard keyboard = new Keyboard();<br />
if (keyboard.AltKeyDown && e.KeyChar.Equals('d'))<br />
{<br />
e.Handled = true;<br />
textBoxName.SelectAll();<br />
}<br />
<br />
}
... but when I use the <alt>-key my Forms parents main-menue got focus
_____________________________
...and justice for all
APe
|
|
|
|
|
Just use the first suggestion: Put a label next to your TextBox, set its Text to something containing "&d" (A&ddress) and assign the tab order to all controls on your form in a way that the label is immediately in front of the textbox.
No additional programming required - works every time.
Oh, and by the way (although I didn't actually try your code) - why are your creating a new Keyboard object? Have you taken a look at the KeyPressEventArgs ? They contain everything you need...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hi,
Someone asked me to help him with the following piece of software, and I don't know even where to start looking. Will this be a big project?
We’re busy with a project developing a website, the background is the tricky part. We’re supplying a scanner that will scan to a FTP site. That part is the easy one, it can scan in pdf and jpg format. The delivery notes they’re scanning will have barcodes on, we need software to read the barcodes and rename the file names according to the codes.
Regards
ma se
|
|
|
|
|
Hi!
Did you try an article search for "barcode" here on CP? I remember there were quite a few articles dealing with the topic...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hi
I am trying to get an image from a resource file into a picturebox.
using the following code:
using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
using System.Reflection;<br />
using System.Resources;<br />
<br />
namespace WindowsApplication16<br />
{<br />
public partial class Form1 : Form<br />
{<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
Assembly Massem;<br />
Image Mimage;<br />
Massem = this.GetType().Assembly;<br />
ResourceManager RM = new ResourceManager("WindowsApplication16.PH1", Massem);<br />
Mimage = (Image)RM.GetObject("MIS_1.png");<br />
pictureBox1.Image = Mimage;<br />
<br />
}<br />
}<br />
}
the form has 1 button & 1 picture box.
Resource name is : PH1.resx - inside there is the image file .
the problem :
When the code finsh i get a NULL image.
Please advise.
i used the explanation on the following MSDN:
http://msdn2.microsoft.com/En-US/library/aa984408(VS.71).aspx
Have a nice Day
|
|
|
|
|
Hi!
You have to take care to use the correct name for the resource. Usually you have to prefix the object's filename with the namespace of your application (e.g. "WindowsApplication16.MIS_1.png" or whatever your namespace is).
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hi,
I cant remember all the details, so this is what I do:
- add the image file to the project, set it to "embedded resource"
(you probably did that already)
- use Designer to add some control (say picturebox) that consumes an image,
and set it up to use your image
- now look at the code Designer has generated for you, and copy/paste what you need
- throw away what you no longer need
Works the first time every time.
|
|
|
|
|
Hi,
I have created a class. In that I have written the following code:
I have added the Header file "using Vishal.TextFileUtils"
Vishal.TextFileUtils is the Supporting header file. You can see it( "http://vishalseth.com/blog/2007/02/20/vishaltextfileutils-library-for-working-with-delimited-text-file-formats).
namespace ConsoleApplication12
{
class Program
{
static void Main(string[] args)
{
DelimitedFile df = new DelimitedFile(new FileFormat(PredefinedFormats.CSV), @"C:\GCProject\Input Example.csv");
foreach (LineEntry le in df)
{
Console.WriteLine(le.FieldValues["MyColumnName"]);
for (int i = 0; bool.Parse(df.Count.ToString()); i++)
{
le.FieldValues["MyColumnName"] = "MyColumnData";
}
}
df.Save(@"C:\output.xls");
}
}
}
When Run the application, I found the error like KeyNotFoundError(I have bold where I am getting the error). Which I not able to find what is happening.
So, the general flow for this application is:
1. CSV Input File is created by user or external application
2. My Application reads data in from CSV file
3. My Application converts records from the CSV file to a new format (xls format)
4. My Application outputs to text file.
Please let me know if you require additional information.
Thanks & Regards,
Liyakhat.
Liyakhat Alikhan, Chennai
-- modified at 10:06 Tuesday 10th July, 2007
|
|
|
|
|
So you are asking someone to write this for you?
only two letters away from being an asset
|
|
|
|
|
I am not mean to say like that....
In other site, I have posted the same question. So, He told me to discribe more.
Thanks & Regards,
Liyakhat.
|
|
|
|
|
It is better you try something and post what is your difficulty and there are many people to help you. It is doubt someone can do everything for you.
Also avoid writing mail Id to avoid spam mail.
All the best for your project!!
Best Regards,
Suman
|
|
|
|
|
liyakhat_shahid wrote: 1. CSV Input File is created by user or external application
2. My Application reads data in from CSV file
3. My Application converts records from the CSV file to a new format (xls format)
4. My Application outputs to text file.
Erm... I can do that without writing 1 line of code. Excel will happily open a CSV text file.
Or is this Homework and you just can't be bothered?
|
|
|
|
|
Hi,
I know how to id manuly, but we have to do it programatically.
thank,
Liyakhat
|
|
|
|
|
J4amieC wrote: Or is this Homework and you just can't be bothered?
liyakhat_shahid wrote: we have to do it programatically.
So the answere is, Yes I think!
All the best,
Martin
|
|
|
|
|
Hi J4amieC,
Can you please tell me how to do it programatically. Atleast send related link. I search google but I didn't find any.
Waiting for u r reply
Thanks & Regards,
Liyakhat.
|
|
|
|
|
liyakhat_shahid wrote: KeyNotFoundError
That's your problem, there is no field called "MyColumnName" in FieldValues. Make sure that you type in the correct string here.
|
|
|
|
|
hi all,
i want to make a search dialog in c#, i want to show it with ctrl+F , now i don't know how can i do it .
i mean when i press ctrl+F the dialog should appear .
please tell mehow can i do it.
Praveen Sharma
|
|
|
|
|
Hi,
in your form:
- set KeyPreview true
- install a KeyPress handler, have it check for letter 'f', if so check
CTRL key is down (use Control.ModifierKeys), if so create a new dialog form and
show it with ShowDialog; you may choose an OpenFileDialog or something you
design yourself.
That should do it.
|
|
|
|
|
thanm u very much Luc , may i know , where u from Luc????
Praveen Sharma
|
|
|
|
|
Belgium, Europe, Earth, Milky Way, Universe
|
|
|
|
|
Belgium, (that's to the west of Germany, as you well know).
|
|
|
|
|
Hi!
In addition to what Luc said, it usually is a good idea to not just offer a single way to access a certain functionality, so you could add a menu to your form, add an Edit/Find command and give it a shortcut of Ctrl+F.
That way, the user can either use the menu or the shortcut and you don't even have to care about keyboard preview on your form yourself...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|