|
It's not needed unless you want to make them install the entire framework.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "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
|
|
|
|
|
|
I am having two list boxes and im trying to add new items,
editing the items in the list box and
removing the items from the list box
i am unable to save the list names after every button click action
can any one please help me to save the items in the List box after every button control
|
|
|
|
|
You've posted three fairly simple questions on list boxes in two hours. Maybe you should invest some time in actually learning how to use C# and WinForms.
Also, your question is unclear. What do you mean, save? List boxes maintain their state naturally, you don't need to save anything when you change the items list.
|
|
|
|
|
You have to be more clear on your question what exactly you want.
A simple way how to add items in Listbox.
Listbox1.Items.Add("Item One");
Listbox1.Items.Add("Item Two");
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
cho mình hỏi muốn tạo cái Save As trong notepad++ phai lam sao vậy
|
|
|
|
|
ku_do_thien wrote: cho mình hỏi muốn tạo cái Save As trong notepad++ phai lam sao vậy
I don't understand, which language is this?!
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
This what Google translator gave me :
ask yourself what you want to create Save As tron notepad++ fade lam sao so.
Its in Vietnamese BTW.
People with high attitude deserve the standing ovation of our highest finger!
My Blog![ ^]
|
|
|
|
|
In Listbox, i need only the alphabetics characters as their names
while editing or adding new items to the List box it should only accept the Alphabets.
can any one please help me in this code using C#
please help me
|
|
|
|
|
You need to check each char of the new entry like this
private static bool CheckEntry(string newEntry)
{
char[] newEntryChars = newEntry.ToCharArray();
foreach (char ch in newEntryChars)
{
if (!Char.IsLetter(ch))
return false;
}
return true;
}
Hope this helps
...and I have extensive experience writing computer code, including OIC, BTW, BRB, IMHO, LMAO, ROFL, TTYL.....
|
|
|
|
|
If you are adding the items to the ListBox using a TextBox, then you can use this to prevent characters other than alphabets to enter in your textbox like this :
void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
Char key = e.KeyChar;
if (Char.IsLetter(key))
{
e.Handled = false;
}
else
{
e.Handled = true;
}
}
People with high attitude deserve the standing ovation of our highest finger!
My Blog![ ^]
|
|
|
|
|
Except if he right clicks and selects "Paste", of course...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
Woops didn't think about it.
People with high attitude deserve the standing ovation of our highest finger!
My Blog![ ^]
|
|
|
|
|
I did something similar (in reverse, numerics only) for a textbox some time ago that handles all use cases - you could tweak the logic for your control to allow only the characters you want. Clickety[^].
|
|
|
|
|
when a control is added to the panel i need to store some details about that control ,for that i tried to use the way of
"panel.Control.add()" but i can't override the add method of the controlcollection of the panel. i'm using c# 3.5 CF.
So is there any way of achieving this , appreciate your ideas,
thanx in advance .
|
|
|
|
|
.NET offers this event[^]. If that isn't available on CF, your best bet might be to provide an AddControl() method which does whatever you want it to do; the disadvantages would be: Controls.Add() remains available, and Visual Designer would not call your method.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
I am using two list boxes and some buttons...
i am trying to shift the items from list 1 to list 2, vice - versa.
while i try to attempt to move names from from one list to another it should accept the same names(i.e, duplicate names should not be accepted)
can any one please help me...
|
|
|
|
|
You just need to check whether the name you are trying to move exists in the ListBox you are trying to move it to. I would keep 2 List<item> 's in memory and bind these to the ListBoxes and Add or Remove from the List<item> and rebind as necessary.
...and I have extensive experience writing computer code, including OIC, BTW, BRB, IMHO, LMAO, ROFL, TTYL.....
|
|
|
|
|
if (!list2.Contains(list1.selectedName))
{
list2.Add(selectedName);
}
- Regards - J O N
A good thing is a bad thing if it keeps you from the best thing. - Dr. Adrian Rogers
|
|
|
|
|
|
The previous solution can be slow if the lists are long. Inserting the names into a hash table will eliminate duplicates and run much faster if there are many names.
|
|
|
|
|
|
I have been trying to write the clipboard content to an external windows application (currently running process) from a C#(WPF) application using SendMessage API and WM_PASTE . Can't get it work. Here is the sample code
public const int WM_PASTE = 0x0302;
[DllImport("User32.dll")]
public static extern Int32 FindWindow(String lpClassName,String lpWindowName);
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern int SendMessage(int hWnd, int msg, int wParam, IntPtr lParam);
private void btn_Click(object sender, System.EventArgs e)
{
int hwnd=0;
hwnd = FindWindow(null, "Untitled - Notepad");
if (hwnd != 0)
{
Clipboard.SetText("sample text from clipboard");
hwnd = FindWindow(null, "Untitled - Notepad");
SendMessage(hwnd, WM_PASTE, 0, IntPtr.Zero);
}
}
Note: have to Notepad app opened to test the code
tried some other possible combinations
SendMessage, WM_PASTE<br />
SendMessage, WM_CHAR<br />
PostMessage, WM_PASTE<br />
PostMessage, WM_CHAR
An alternate way to send keystrokes to an extern app using SendMessage and PostMessage
SendMessage, (WM_KEYDOWN, WM_KEYUP) For CTRL+V<br />
PostMessage, (WM_KEYDOWN, WM_KEYUP) For CTRL+V
Windows.System.Forms.SendKeys.SendWait("^V") -> works but not always
any idea?
- Regards - J O N
A good thing is a bad thing if it keeps you from the best thing. - Dr. Adrian Rogers
modified on Wednesday, April 20, 2011 6:17 AM
|
|
|
|
|
alright, getting the child window of the notepad application works which is the edit control.
we can do a PASTE only in the edit panel of the notepad application. modified code below...
GetWindow_Cmd.GW_CHILD = 5
int hwnd=0;
int hwndChild=0;
hwnd = FindWindow(null, "Untitled - Notepad");
if (hwnd != 0)
{
Clipboard.SetText("sample text from clipboard");
hwnd = FindWindow(null, "Untitled - Notepad");
hwndChild = GetWindow(hwnd, GetWindow_Cmd.GW_CHILD);
SendMessage(hwndChild , WM_PASTE, 0, IntPtr.Zero);
}
now, how do i find the window handle of the static edit control of "winword" and "mspaint" application
same approach doesn't work...
any idea?
- Regards - J O N
A good thing is a bad thing if it keeps you from the best thing. - Dr. Adrian Rogers
|
|
|
|
|
-
ok, i think, using WM_PASTE to paste the contents into word or paint is somewhat complex.
not able to find a way to get the handle of the edit panel.
a simple solution is adopted and it works
Win32.SendMessage(hWnd, Win32.WM_SYSCOMMAND, (IntPtr)Win32.SC_RESTORE, IntPtr.Zero);
Win32.SetForegroundWindow(hWnd);
System.Threading.Thread.Sleep(100);
System.Windows.Forms.SendKeys.SendWait("^v");
- Regards - J O N
A good thing is a bad thing if it keeps you from the best thing. - Dr. Adrian Rogers
|
|
|
|