|
thanks dave. I shall get back to you.
regards,
NetQuestions
|
|
|
|
|
Colleagues,
Is there a standard (and free) control which is like a ComboBox, only better? Some of the potential features could be:
* being able to control the font for each of the items individually
* icons, checkboxes next to the items
If such thing exists, could you post a reference? If not, then I’ll stop the wishful thinking and carry on with the standard ComboBox.
Cheers,
- Nick
|
|
|
|
|
You may like to investigate WPF where it is relatively easy (after the steep learning curve) to create such controls yourself. Take a look at some of the WPF articles here on CodeProject to see the sort of things that can be done. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Hi,
ComboBox (as well as ListBox):
1. holds and shows items of any type you choose, not just strings.
2. supports "user drawing", see DrawMode property and DrawItem event.
Hence you could:
- define your own little class representing such item, with all the properties you'd like;
- paint it yourself in whatever format you like.
I often do this with ListBox, and occasionally with ComboBox.
And no, I don't have a published example around.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
You might want to subclass the combobox and add your own functionality as shown here[^].Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
Using VB 2008 and a simple MDI application...
When the active mdi child is maximized, there is a small gap between the right side of the child and the right side of the parent. Admittedly not a life-altering problem but it is worrisome. Anyone know of a fix?
|
|
|
|
|
Hi,
Please forgive me as this may be a very simple question but I am a newbie at this. I have searched for this info for three days now and cannot seem to find any answers. I have two questions:
Q1. How do I reset the background color of a push button.
I have a standard button. In the code snippet below I also have a cursor style change. The cursor changes back to the original (default cursor) when the mouse leaves the button (without me including any cursor specific code in the MouseLeave function) but the back color does not change. I even tried to set up a pointer to store the original color and this works but after the mouse leaves the button the style of the button is chnaged to flat. Do I need to also store the FlatStyle and retrieve it on MoudeLeave?
// declare an int pointer (for the exit button background color) called
btnExit_default_BackColor
int *btnExit_default_BackColor;
// declare a boolean pointer (for the exit button UseVisualStyle background color) called
btnExit_default_UseVisualStyleBackColor
bool *btnExit_default_UseVisualStyleBackColor;
private: System::Void btnExit_MouseEnter(System::Object^ sender, System::EventArgs^ e) {
// allocate memory for an int variable and make the btnExit_default_BackColor pointer
point to this new memmory
btnExit_default_BackColor=new int;
//assign the exit button background color to the memory allocated
*btnExit_default_BackColor=btnExit->UseVisualStyleBackColor;
// allocate memory for a bool variable and make the btnExit_default_UseVisualStyleBackColor
pointer point to this new memmory
btnExit_default_UseVisualStyleBackColor=new bool;
//assign the exit button background color to the memory allocated
*btnExit_default_UseVisualStyleBackColor=btnExit->UseVisualStyleBackColor;
btnExit->Cursor=Cursors::Hand; // change mouse cursor to hand when over a push button
// Change button outline color to 0x00FF4500 (orange red with opacity 0)
System::String^ highlightColor="#0x00FF4500";
btnExit->BackColor=System::Drawing::ColorTranslator::FromHtml(highlightColor);
}
private: System::Void btnExit_MouseLeave(System::Object^ sender, System::EventArgs^ e) {
// Change button outline color to original state before mouse hover
btnExit->BackColor=System::Drawing::Color::FromArgb(*btnExit_default_BackColor);
btnExit->UseVisualStyleBackColor=*btnExit_default_UseVisualStyleBackColor;
delete btnExit_default_BackColor; // delete the btnExit_default_BackColor pointer
delete btnExit_default_UseVisualStyleBackColor; // delete the
btnExit_default_UseVisualStyleBackColor pointer
btnExit_default_BackColor=0; // set pointer to null
btnExit_default_UseVisualStyleBackColor=0; // set pointer to null
}
This seems very complicated for what I think is a very simple thing. I just want the color of the button to chnage when the mouse is over it and have the button revert to its original (design) state when the mouse leaves. Can someone please help me with this. Thank you very much in advance for any help you may be able to provide.
Q2. Can someone please explain to me the funcion of the ^ in the parameter list of the functions above; i.e. in
private: System::Void btnExit_MouseLeave(System::Object^ sender, System::EventArgs^ e) {
I cannot find any reference to this operator. The closest I have come is that it may be a top-level reference but I don't know what this means and how it works,
Please forgive if these are too simple questions. Thank you.
Paul
|
|
|
|
|
I can't answer your first question but I can explain the ^ operator:
That operator is a reference to a managed object.
So, if you have
void btnExit_MouseLeave(System::Object^ sender, System::EventArgs^ e)
That means that the function takes a reference to a System:Object and a reference to a System::EventArgs object.
If you have Object* obj , it means that obj points to the object on the heap.
In the same way, the ^ means that the variable points to the object on the managed heap.
The ^ is used with the gcnew operator to assign a new object instance to a variable, as in:
Object^ var = gcnew Object()
|
|
|
|
|
We can use SharePoint API as well as SharePoint List web reference to update List Items. Using API it is quite straight forward as we can directly assign a DateTime object against a DateTime field in SharePoint list. But with List web reference it is not that straight forward as we need to first convert the DateTime object into the SharePoint DateTime formatted string and then assign it to the specific field.
http://www.mindfiresolutions.com/lp/sharepoint-development.htm[^]Cheers,
Eliza
|
|
|
|
|
I have a couple of custom controls in the same project (Visual Studio 08) that inherit from UserControl. Is there away that I can hide one of the controls from the toolbox, during "application" design time? C#, if it matters.
Thanks!
|
|
|
|
|
If you really need to, delete them by right click and delete.
I would prefer adding a tab and have all my controls in that.
|
|
|
|
|
Hello,
In my winapp targetting .Net FW v2.0.50727, a SQLConnection.Open() is done following FolderBrowserDialog.ShowDialog().
On the SQLConnection.Open(), I get the following error: "Error in the application"
stack trace
================
at System.Threading.TimerBase.AddTimerNative(Object state, UInt32 dueTime, UInt32 period, StackCrawlMark& stackMark)
at System.Threading.TimerBase.AddTimer(TimerCallback callback, Object state, UInt32 dueTime, UInt32 period, StackCrawlMark& stackMark)
at System.Threading.Timer.TimerSetup(TimerCallback callback, Object state, UInt32 dueTime, UInt32 period, StackCrawlMark& stackMark)
at System.Threading.Timer..ctor(TimerCallback callback, Object state, Int32 dueTime, Int32 period)
at System.Data.ProviderBase.DbConnectionPool.CreateCleanupTimer()
at System.Data.ProviderBase.DbConnectionPool.Startup()
at System.Data.ProviderBase.DbConnectionPoolGroup.GetConnectionPool(DbConnectionFactory connectionFactory)
at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPool(DbConnection owningObject, DbConnectionPoolGroup connectionPoolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at FolderBrowseAndSQLConnect.Form1.button2_Click(Object sender, EventArgs e) in E:\mybackup\FolderBrowseAndSQLConnect\FolderBrowseAndSQLConnect\Form1.cs:line 29
Please give suggestions to solve this problem. I run it on a "Win XP Professional SP3 Version 2002". Interestingly, this issue is not reproducible from other machines that have the same OS & .Net FW configuration.
Thanks
|
|
|
|
|
Can you post the code from Form1.button2_Click?
I are Troll
|
|
|
|
|
Sorry for the delay, here's the code:
private void button2_Click(object sender, EventArgs e)
{
try
{
string connStr = "";
if (string.IsNullOrEmpty(txtUser.Text) && string.IsNullOrEmpty(txtPswd.Text))
connStr = String.Format("Data Source={0};Integrated Security=SSPI",txtSQLServer.Text);
else
connStr = String.Format("Data Source={0};user id={1};password={2}", txtSQLServer.Text,txtUser.Text,txtPswd.Text);
SqlConnection sqlConn = new SqlConnection(connStr);
sqlConn.Open();
MessageBox.Show("succesfully queried databases");
sqlConn.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
|
|
|
|
|
You're getting the Application Error on sqlConn.Open, and only on that specific machine? How does the connection-string look when you debug the application?I are Troll
|
|
|
|
|
Answer to Q#1.1: Yes the application error is on sqlConn.Open.
Answer to Q#1.2: Yes, this is reproducible only on some machines.
Answer to Q#2: connection string looks like this - "Data Source=computer-88\\sqlexpress;Integrated Security=SSPI"
|
|
|
|
|
Looks good, doesn't seem to be a problem with the code. It was on a specific machine? Could there be another application running that's using the same port as SQL Express?
You might want to try to connect over IP, using the default port-settings. If it helps, we'll have a clue where to look next I are Troll
|
|
|
|
|
Hi All,
I am inserting a toolStripSplitButton into the ToolStrip. And all the things are going fine.
At run time. when I select a Item from a DropDown items, the button part of the Split Button doesn't comes into the Pressed state.That is end user will not get to know that the item is selected.
I want the button part of the Split Button should work like a toggle button when a item is selected from DropDown or from the Button directly.
Let me known about the rendering if required, I do not know much about Rendering.
thanks
Rahul Kapoor.
|
|
|
|
|
|
Sir, let me know how can I set a read only property ?
Let me know something from the corner.
|
|
|
|
|
My bad, I mixed up the ToolStripSplitButton with a ToolStripButton. The property is indeed readonly, I didn't find any "nice" solution to display the button in a checked state.
It has been reported on Microsoft Connect[^] in 2005, but it doesn't mention what version of the Framework that this applies to.
There's no Checked property in the ToolStripSplitButton, nor in the ToolStripDropDownButton. That leaves only the option of extending the controls and building the desired functionality yourself, using owner-drawing.
I found a thread of someone who did that here[^].
I are Troll
|
|
|
|
|
i want to create a IM using c#.net win. app. + MSSQL
can anyone help me with this
here are some idea that may help u.
No log in at all
just type ur unique username and that it
this can be use in one workstation only
cos we are using one SQL server
pls help me with this thanks...
|
|
|
|
|
rockracker wrote: pls help me with this thanks...
1) analyse your requirements & document them
2) do some research and see whats out there that may assist
3) do a design, include logging, monitoring, test plans etc
(you may need to iterate through 2 & 3)
4) write some code to implement the design/missing pieces
5) test
6) when you have specific coding issues, post code, symptoms/diags etc back here
easy !
'g'
|
|
|
|
|
As Garth said; furthermore try using normal language, not txtspk, and when you later need to show some code please use PRE tags to achieve best readability.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
Luc Pattyn wrote: and when you later need to show some code
Code, code you think he wants to create some code, don't be silly, he wants YOU to create the codz.Never underestimate the power of human stupidity
RAH
|
|
|
|