|
The controls in any Microsoft product tend to be custom written, so they have the edge for a while, then custom control writers make money on selling the 'VS UI' or the 'Office UI' toolkit.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I only know for the .NET Framework v2.0
There is a control which is named
System.Windows.Forms.ToolStripDropDownButton
This control could be added in the control bar.
I recommend to download the Visual Studio 2005 c# express edition beta2 (for free because its a beta).
There is a very good formdesigner in there.
Yours sincerely,
Berni
|
|
|
|
|
Hi,
I have another question, that is regarding to the posting using C#. I am writing an application that is suppose to post data for further processing to another person. I am aware of posting data to the file using file stream. Is there any other mehtod available that data will be carry over ethernet so that I can create another page to retrieve those results. Here is another challenge I am facing, I don;t want to carry that data using URL string. I want that data to be hidden from the user. I am aware of sessions but I have double dimension arrays, and I don't how to use sessions to store the double dimension arrays. I will appreciate any input on this issue. Thanks,
IT specialist
|
|
|
|
|
Hi Guys,
I have another question. I was wondering if there is a way to user Server.Create method that was supported in ASP. Can you please provide me gidance regarding that. I have a dll that happens to work with Server.Create object and it is residing on server. I tried to use that dll as reference in C# web project, but Ihad no luck with it. Now I have decided to use that dll by using Server.Create object. Any help will be appreciated. Thanks,
|
|
|
|
|
Isn't Server.Create for COM objects? If so, just use COM interop.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I've created a class that needs to have a subclass array of the same class, so basically my class contains an array of itself. Does this make sense? What is the best way to go about doing this? Basically I need to make a heirarchy of these classes that can never end
Class
Class1
ClassA
ClassB
Class2
All these classes have the same properties.
Thanks,
JGA
-- modified at 20:49 Monday 24th October, 2005
|
|
|
|
|
You mean an array of class types ? You can't do this, because Class1 cannot derive from ClassA and ClassB, and if it did, this couldn't work when both classA and classB expose the same methods. The obvious thing would be to create an interface, and impliment it in all of these classes, but your class heirarchy would be flat, you could have one base class at most on each level, and they would all impliment the interface in the same way
What are you trying to do ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have a todo list heirarchy and each element can have it's own properties (due date, title, priority). so I can have:
Class=
Title:Version 1
DueDate: 12/01/05
Priority: High
SubClass:
Title:Create blah
DueDate: 10/26/05
Priority: High
I'm reading from an XML File to get all of the data, the XML format is something like:
<TODOLIST>
<TASK DUEDATE=10/24/05 TITLE=ASDF PRIORITY=HIGH>
<TASK TITLE=sdfa></TASK>
</TASK>
Does that make sense at all?
|
|
|
|
|
OK - so there's no reason in the world to create a class heirarchy. All you need to do is create a class ( or a struct, more like it ), that contains a reference to itself as a parent and a collection of items that represents it's children ( so you can iterate in either direction ).
So you need one class, like this
class myClass
{
private string title;
private DateTime dueDate;
private PrioryEnum priority; // Create an enum for this
private myClass parent;
private ArrayList children;
}
Then add properties for access as needed.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
do you'd just create an arraylist of class myclass right?
|
|
|
|
|
jgallen23 wrote: do you'd just create an arraylist of class myclass right?
If you're using VS2005, then yes, you can create an array of a specific type. Otherwise, the arraylist will contain only objects, but yes, it would be an array of the class instances that are the children of the current object.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi All
I must ask 2 question that i cant find the answer for them
1. When i use c++ [MFC] i add the function GetDlgCtrlID to get Ctrl Id of the CButotn os CList when i set some event of the Button or list.
Does in C# there is some parallel method that return the ID of the control ?
2. I need to load some WAV file and play it in Real Time.
How can i do it in C# ?
Thanks for the help.
|
|
|
|
|
yanshof wrote: Does in C# there is some parallel method that return the ID of the control ?
The base control class has an ID property. The ID is a string, not a number, as it was in C++.
yanshof wrote: 2. I need to load some WAV file and play it in Real Time.
How can i do it in C# ?
Import the PlaySound API using pinvoke, or use Managed DirectSound.
[DllImport("coredll.dll")]
public static extern int PlaySound(
string szSound,
IntPtr hModule,
int flags);
public enum PlaySoundFlags : int {
SND_SYNC = 0x0, // play synchronously (default)
SND_ASYNC = 0x1, // play asynchronously
SND_NODEFAULT = 0x2, // silence (!default) if sound not found
SND_MEMORY = 0x4, // pszSound points to a memory file
SND_LOOP = 0x8, // loop the sound until next sndPlaySound
SND_NOSTOP = 0x10, // don't stop any currently playing sound
SND_NOWAIT = 0x2000, // don't wait if the driver is busy
SND_ALIAS = 0x10000, // name is a registry alias
SND_ALIAS_ID = 0x110000,// alias is a predefined ID
SND_FILENAME = 0x20000, // name is file name
SND_RESOURCE = 0x40004, // name is resource name or atom
};
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Can you guys tell me if these are correct? I'm parsing a file, word by word, and I'm trying to see if they fit into the correct format.
The first format is if the token is a double. Meaning we have 1234 or 1234.0123
What I have is if( (Regex.IsMatch( token, @"\d*")) || (Regex.IsMatch( token, @"\d*[.]\d*")) )
The second is if it is a letter followed by any other alphanumeric up to 10 characters total in length:
if( Regex.IsMatch( token, @"\b[a-zA-z]\w{2,3,4,5,6,7,8,9}\b") )
Do those look right?
Thanks in advance!
|
|
|
|
|
jeweladdict wrote: What I have is if( (Regex.IsMatch( token, @"\d*")) || (Regex.IsMatch( token, @"\d*[.]\d*")) )
You can do this with one regex
@"\d*([.]\d*)?"
jeweladdict wrote: if( Regex.IsMatch( token, @"\b[a-zA-z]\w{2,3,4,5,6,7,8,9}\b") )
YOu can shorten {2,3,4,5,6,7,8,9} to {2, 9}.
Expresso is the program you need to test your regex, just google it, I think it's on CP tho.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
@"\d*([.]\d*)?" seems to work for IP addresses as well. I tried using the @"\b\d*([.]\d*)?\b" but that didn't seem to help. I'm only looking for numbers that are possible doubles. Any ideas?
|
|
|
|
|
I have a problem when I try to copy the richtextbox text to the items in a listbox. Is there a way to stop it from placing the entire richtextbox text as 1 item. below is an example of what I mean.
http://img456.imageshack.us/img456/1223/listbox8al.png
|
|
|
|
|
Split the string on \r or \n, whichever is the delimiter that's causing the boxes you see. You need to split the string, then insert it one line at a time.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I did this and it seems to not be working, im stuck.
myRTF = richTextBox1.Rtf;
while (myRTF.Length > 0)
{
//Find the index of the RTF Return Character
int index = myRTF.IndexOf("\r\n");
//Extract the RTF to that point
string temp = myRTF.Substring(0, index);
//Trim the extracted part of the RTF
myRTF = myRTF.Substring(index, myRTF.Length - index);
//Add the item to your list box
listBox1.Items.Add(temp);
}
|
|
|
|
|
This is C#, your string class has a split method. Try splitting on just \r, or just \n. The boxes you get in your list box make me think the rich text control is returning one of those two, and not both. So, call the split method and get a string array, use for each to pass them into the list box.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I did try to do the split on just /n or /r but no luck?
|
|
|
|
|
Just a sec, I'll whip up a project for you
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
Your slash is the wrong way around. This works:
string text = richTextBox1.Text;
string [] strings = text.Split('\n');
foreach (string s in strings)
{
if (s.Length > 0)
listBox1.Items.Add(s);
}
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
You own man, thanks a bunch!!
Ron
|
|
|
|