|
Hi,
I would like to know what are some of the benefits of using C# vs C++ (MFC) specifically regarding GUI's. I've heard that it offers the ease of creating gui's that visual basic has offered developers for years, but I would like to know what specifically is more "easier" in C#? I've developed GUI's using MFC for many years, and at a first glance at C# GUI toolbox it looked pretty similar to what i've been used to and didn't find anything that is much different.
Any help and pointers from the experts out here would be greatly appericated.
Thanks
|
|
|
|
|
The language is suited to putting applications together quickly. Layout and dynamic adding of controls is easier than MFC (and I speak as an ex MFCer here). It's quicker to put together pattern and tier based solutions than C++ is, plus the event handling code is far easier to work with than the MFC Message Maps. Plus (and this is a big plus on my part), it's much easier to ignore Document View and actually work with patterns like Model View Controller (MVC).
|
|
|
|
|
The extension of WPF support for VB and C# allows for much better GUIs in those languages in my opinion.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Hello
I'm new to C# I'm looking for a good documented code to implement auto complete combobox
I've seen some code here but without any documentation, nor the way to use it
I've also hear about a notinlist event for ComboBox but that event is not available in csharp 2005 nor 2008
|
|
|
|
|
baranils wrote: I'm looking for a good documented code to implement auto complete combobox
Have you actually tried yourself and experimented? It really is very easy - you won't find a great deal of documentation anywhere as the code is almost 'self commenting'.
Just have a go and post back with specifics if you get stuck
Dave
|
|
|
|
|
Hello
I've added the source provided to my project
It compiles
But I do'nt know how to set a new combobox into my form nor from the designer nor from programming
And till now I never had add a object by code, I always use the designer
I'm leaning C# since a few weeks now I can already do many things but many things remain obscure
Another example of good documented code :
I've found dgvprinter here it is wonderfull !
The authors gives all the information about using the code and it was very easy to implement, understand and use, but it was a portion of code I'm much familiar with code library than component library
|
|
|
|
|
All the auto complete functions of a combo box can be set in the designer. If you need to do it through code - this should get you started. (I've commented it for you but it should be very obvious what's happenning even without the comments)
AutoCompleteStringCollection myAutoCompleteCollection = new AutoCompleteStringCollection();
myAutoCompleteCollection.Add("Test entry 1");
myAutoCompleteCollection.Add("Test entry 2");
ComboBox myComboBox = new ComboBox();
myComboBox.AutoCompleteMode = AutoCompleteMode.Suggest;
myComboBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
myComboBox.AutoCompleteCustomSource = myAutoCompleteCollection;
myComboBox.Location = new Point(13, 13);
myComboBox.Size = new Size(121, 21);
this.Controls.Add(myComboBox);
Dave
|
|
|
|
|
I'm sorry but I'm a really newbie
First of all I want to be able to add the special combobox from the designer
In my project
1- I have a form (form.cs)
2- I have the designer of that formForm.Designer.cs
3- I have added the source of Matt.Berther.Control for special combobox CodeFile1.cs
4- I have added the using Matt.Betrther.Control directive in my project
NOW !
How can I visualy add an autocomplete combobox into my form
Is it possible or do I have to define everything the code editor it is not realy practicall to ajust size and position that way and I never did it for any control !
|
|
|
|
|
Ahhh - you didn't say you were using a custom control and not the standard combo box!
Have you got a link to where you got this from?
Dave
|
|
|
|
|
|
Omit any of these steps if you've already done them!
1. Right click your project in solution explorer and chose Add|Existing Item.
2. Browse to AutoCompleteComboBox.cs and click Add.
3. Hit F5 to run your project.
4. In Design view, open the toolbox and you'll find a new entry 'AutoCompleteComboBox' at the top.
5. Use like any other control.
Dave
|
|
|
|
|
Hello
Thans a lot !
I don't know how I miss it (it was probably too high in the toolbox) !!
However I will now inspect the code because it does'nt react as I expect but exactly as a standard CB for now
You assistence is Great !!
|
|
|
|
|
Hi, i use
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
pd.Print();
to print something to printer.
there's a small dialog box appear for a second saying the
document file name with a 'Cancel' button. I think is not
PrintDocument doing this, but Windows.
Somebody know how i can hide this dialog??
or
Someone know other print command than 'PrintDocument'
that i can use to prevent showing this dialog???
|
|
|
|
|
Hi
go to this link it will help you
Click Here
Yogesh Agarwal
|
|
|
|
|
I have a text box with a URL in in.
How do I get my application to recognize the URL and open the corresponding webpage when it is clicked?
Here is what I am putting in the text box:
<code>txtAbout.Text = "Developed by Teboweb.Com 2008" + Environment.NewLine + Environment.NewLine +
"Be sure to check www.teboweb.com/firstofficernews.html for news on updates etc."</code>
I realize this is very much a beginners question and I have googled but to no avail.
You always pass failure on the way to success.
|
|
|
|
|
Use richtextbox control instead of textbox ans set DetectUrls property to true. You can also use LinkLabel class for displaying urls
|
|
|
|
|
Thank you Giorgi.
You always pass failure on the way to success.
|
|
|
|
|
what type of text box are you using?
- System.Windows.Forms.TextBox
- System.Windows.Forms.MaskedTextBox
- System.Windows.Forms.RichTextBox
|
|
|
|
|
SpacixOne wrote: 1. System.Windows.Forms.TextBox
Giorgi has provided a solution for me - thanks for asking.
You always pass failure on the way to success.
|
|
|
|
|
Hi guys,
I am trying to update an old application that was designed by another programmer. I am not very sharp at C# and need your help.
Can you please help me understand the following code that is in the windows service
IPHostEntry hostEntry=Dns.Resolve(m_sServerAddr);
IPAddress ipAddress = hostEntry.AddressList[0];
IPEndPoint ipEndPoint = new IPEndPoint(ipAddress,m_nPort);
m_svSocket = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
m_svSocket.Bind(ipEndPoint);
m_svSocket.Listen(10);
while(true)
{
Socket rtSocket=m_svSocket.Accept();
if(rtSocket.Connected)
{
TD.WaitCallback myCallBack = new TD.WaitCallback(ProcessClientRequest);
TD.ThreadPool.QueueUserWorkItem(myCallBack,rtSocket);
}
}
ProcessClientRequest has a bunch of functions called like getschedule from database etc. I am trying to force Processclientrequest to reload the schedule from the database without restarting the service.
Please help.
Sameer
|
|
|
|
|
Wow, looks more like a coding horror to me...
People run that code on their PC??
|
|
|
|
|
no the service is installed on the server. It has run and currently runs great with no problems. What do you mean by coding horror? Also, the attached code is called by the timer. Here is the full function.
private void StartTimerAndServerSocket()
{
Writ2ErrLog("Service Timer Initialized");
string sErr="Application is ready for processing";
try
{
Writ2ErrLog(sErr);
m_tMonitor = new TD.Timer(new TD.TimerCallback(MonitorFunc),1, 0,45000);//45 sec
if(m_sServerAddr==string.Empty)
{
m_sServerAddr=Dns.GetHostName();
}
if(m_nPort==-1)
{
m_nPort=1024;
}
IPHostEntry hostEntry=Dns.Resolve(m_sServerAddr);
IPAddress ipAddress = hostEntry.AddressList[0];
IPEndPoint ipEndPoint = new IPEndPoint(ipAddress,m_nPort);
m_svSocket = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
m_svSocket.Bind(ipEndPoint);
m_svSocket.Listen(10);
while(true)
{
Socket rtSocket=m_svSocket.Accept();
if(rtSocket.Connected)
{
TD.WaitCallback myCallBack = new TD.WaitCallback(ProcessClientRequest);
TD.ThreadPool.QueueUserWorkItem(myCallBack,rtSocket);
}
}
}
catch(Exception ex)
{
m_svSocket.Close();
m_tMonitor.Dispose();
sErr="Start Error " + ex.Message;
}
finally
{
if(sErr!=string.Empty)
{
Debug.WriteLine(sErr);
Writ2ErrLog(sErr);
}
}
Sameer
|
|
|
|
|
I have a class with three properties and i override the ToString method to return a concat of them.
now i'd like to have a textbox with a customsource foe the auto complete but i'd like to be able to type any one of the properties and show the relevant ToString output.
IE.
Item1.p1 = "Johnson"; Item1.p2="Chuck"; Item1.p3=50;
Item2.p1 = "Johnson"; Item2.p2="Michelle"; Item2.p3=20;
Item3.p1 = "Johnson"; Item3.p2="Joe"; Item3.p3=15;
Item4.p1 = "Joe"; Item3.p2="Black"; Item4.p3=10;
Item.ToString(){
return string.format("{0},{1}-{2}",p1,p2,p3);
}
now if you type John in the textbox id like to autocomplete to show (p1.tostring,p2.tostring and p3.tostring)
if you type "Joe" the drop down should have (p3.string and p4.tostring)
Any ideas?
|
|
|
|
|
cechode wrote: now if you type John in the textbox id like to autocomplete to show (p1.tostring,p2.tostring and p3.tostring)
Since John doesn't match your example, the autocomplete shouldn't work at all.
You would have compare each item to find a match anywhere in the string. Not very reliable since you will undoubtedly have duplicates.
only two letters away from being an asset
|
|
|
|
|
i dont have any duplicates in the list (a dup would be two items with both p1 and p2 equal).
essentially i'd like you to be able to type any value from any of the two properties (p1 or p2) but have the autocomplete (suggest) show you the Tostring of the object not what you type. ( real world example makes more sense )
|
|
|
|