|
Hi,
I am just trying to adapt the Extended Common Dialog Box
http://msdn2.microsoft.com/en-us/library/ms996463.aspx
to my needs. Now I have got two problems left:
1. I want this dialog ("GetOpenFileName" from ComDlg32.dll) to appear modal with my Windows-Forms application. It is dangerous that the user can open as many of these dialogs as he wants because the "Open File"-Button of the calling Form is always enabled... I am not very experiences in using Win32-dlls and I have no idea how to approach this problem.
2. If you are a bit familiar with the above msdn-example perhaps you can help me also with this: I changed the dialog to a multi-file-select dialog (adding the AllowMultiSelect-flag). As expected the dialog can only return a few files (as string like e.g.: 'C:\Programs\"test1.txt" "test2.txt"') as const int _MAX_PATH is by default set to only 270. So I changed it to 32768 bytes which is the maximum allowed value as I have learned. But when I now select more files in this dialog it returns nothing!???
Thanks in advance for any idea,
Alex
|
|
|
|
|
AlexZieg71 wrote: So I changed it to 32768 bytes which is the maximum allowed value as I have learned
That looks like the maximum allowed value for a signed short ( at a guess). MAX_PATH is set to the right value for a maximum path.
There are solutions on the web to extending an open file dialog in C#, I'd suggest finding one of those.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi Christian,
I only found the solution that I am just working with and the "OpenFileDialogEx" on the CodeProject-pages. The problem with OpenFileDialogEx is that it only works for .NET 2.0 but I work with .NET 1.1.
Do you know another solution? Your answer makes me think that my 2 described problems are barely to solve.
Best Regards
Alex
|
|
|
|
|
OK, I found out the solution for my Problem #1 myself:
In the GetOpenFileName-Struct you can also define the owner of the form as an IntPtr. Assign the Handle of the "Owner-Form" to it and it´s done:
_ofn.hwndOwner = owner.Handle;
|
|
|
|
|
How to find a word in textbox?
thx
nemanja
|
|
|
|
|
textbox1.Text gives you the text, the string class contains methods for finding text within strings.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Can you write me some example plz!
thx
nemanja
|
|
|
|
|
When people ask trivial questions, that google could answer in seconds, I tend to provide some keywords, because it's really important for someone who wants to be a developer, to be able to do some research for themselves. Given what I told you, intellisense should be all you need to solve the problem.
The methods that search for the index of a substring, return -1 if they don't find it.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
if you want to implement some search functionality, defintely there must be some buch of text that will occupy the controll. right.. then go for richtextbox instead of textbox. That is having inbuilt function for "find"
This is my suggestion.. otherwise you hav to implement the logic to do so.
|
|
|
|
|
I want to fill my combo box with alphabet
nemanja
|
|
|
|
|
And ?
------------------------------ "The Soapbox has been so ..."
|
|
|
|
|
Automaticly!!
Not Manual!
nemanja
|
|
|
|
|
Create a custom control. Then you only have to create it once.
|
|
|
|
|
private void PopulateComboBox()
{
for (int i = 65; i < 91; i++)
{
comboBox1.Items.Add(Convert.ToChar(i));
}
}
|
|
|
|
|
Here is one way:
for (char i = 'A'; i <= 'Z'; i++) comboBox1.Items.Add(i);
---
Year happy = new Year(2007);
|
|
|
|
|
Well I didn't know you could increment chars. Assimilated
|
|
|
|
|
A char automatically converts to an int, I believe. It definatley does in c++.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Not automatically, you have to cast it.
A char in C# is a unicode character, while a char in C++ is actually not a character at all, but a byte.
---
Year happy = new Year(2007);
|
|
|
|
|
comboBox.DataSource = {'a','b','c','d','e','f','g','h','i','j','k' ... 'z'};
Just being funny. But itll work.
File Not Found
|
|
|
|
|
Here's another funny one.
public static class Alphabet {
public static IEnumerator Lower() {
for (char i = 'a'; i <= 'z'; i++) yield return i;
}
public static IEnumerator Upper() {
for (char i = 'A'; i <= 'Z'; i++) yield return i;
}
}
foreach (char i in Alphabet.Lower()) comboBox1.Items.Add(i);
---
Year happy = new Year(2007);
|
|
|
|
|
thats what I wrote the first time. But I created an interface first then I deleted the entire post because I was afraid someone would think I was serious.
File Not Found
|
|
|
|
|
Can someone give me an example pattern that matches:
$1.25
I can't seem to figure out how to match a literal "$" as it's not a valid escape character...
Thanks!
|
|
|
|
|
|
The $ character has a special meaning in regular expression (matching the end of the string). Use \$ to match a literal $.
---
Year happy = new Year(2007);
|
|
|
|
|
Nitron wrote: match a literal "$" as it's not a valid escape character...
As the other responses suggest, you should be able to escape the $. An alternative is to put it like this: [$] instead of escaping it.
|
|
|
|