|
Thank you, that article is perfect.
|
|
|
|
|
I'll make sure and tell the author.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
I implemented the solution to my project easily, but there is only one problem. I need to change the enabled property of a ToolStripMenuItem inside a thread and ToolStripMenuItem is not a Control. Therefore, I can't use this method. What can I do?
|
|
|
|
|
Use the control that owns the item, so either the ToolStrip or the form. Set up a delegate there that invokes a method that sets the enabled state, and invoke that delegate as you would any other.
|
|
|
|
|
I came up with this, is this a good solution?
public delegate void ControlTSBoolConsumer(ContextMenuStrip cms, ToolStripMenuItem tsmi, bool choice);
private void SetTSEnabled(ContextMenuStrip cms, ToolStripMenuItem tsmi, bool choice)
{
if (cms.InvokeRequired)
cms.Invoke(new ControlTSBoolConsumer(SetTSEnabled), new object[] { cms, tsmi, choice });
else
tsmi.Enabled = choice;
}
|
|
|
|
|
I expect that to work fine.
I am aware the MSDN documentation doesn't say much about this, and neither does my article. I probably should add the following paragraph:
There are several items that Visual Designer can add to a Form although they aren't Controls; they are either parts of a Control (e.g. MenuItem, ToolStripMenuItem, ...) or Components (Forms.Timer, SerialPort, ...); for all of these I think a good approach is to choose a Control on which InvokeRequired/Invoke can be used; the Form itself is a good candidate for solving threading unsafety issues.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
|
hi guys
when i run this code it throw an exception
but it run well inside SQL Server 2008
ALTER proc [dbo].[back_up_database]
as
ALTER DATABASE [vvvvvvvvvvv]
SET OFFLINE
go
BACKUP DATABASE [vvvvvvvvvvv]
TO DISK = 'D:\SQLServerBackups\vvvvvvvvvvv.Bak'
with NO_COMPRESSION
go
ALTER DATABASE [vvvvvvvvvvv]
SET ONLINE
go
so what is the problem
thanks,
Mohamed El-Wehishy
|
|
|
|
|
Mohamed El-Wehishy wrote: when i run this code
What do you mean? Run it where/how?
Mohamed El-Wehishy wrote: it throw an exception
What exception?
only two letters away from being an asset
|
|
|
|
|
ok man this is my code
private void button1_Click(object sender, EventArgs e)
{
try
{
SqlConnection cn = new SqlConnection("initial catalog=vvvvvvvvvvv;server=.;integrated security=sspi");
SqlCommand cmd = new SqlCommand("back_up_database", cn);
cmd.CommandType = CommandType.StoredProcedure;
cn.Open();
int i = cmd.ExecuteNonQuery();
cn.Close();
if (i > 0)
{
MessageBox.Show("Your database is backed up");
}
}
catch(Exception ex)
{
MessageBox.Show("Sorry we can not back up your database");
}
}
when i run this code it throw exception
but when i execute the stored procedure
ALTER proc [dbo].[back_up_database]
as
ALTER DATABASE [vvvvvvvvvvv]
SET OFFLINE
go
BACKUP DATABASE [vvvvvvvvvvv]
TO DISK = 'D:\SQLServerBackups\vvvvvvvvvvv.Bak'
with NO_COMPRESSION
go
ALTER DATABASE [vvvvvvvvvvv]
SET ONLINE
go
it completed successfully
so what is wrong
thanks for your interest
Mohamed El-Wehishy
|
|
|
|
|
Read the previous response. What is the exception that is being thrown????
only two letters away from being an asset
|
|
|
|
|
why, WrongForumException, the most popular of all; what else could it be?
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
hi guys
please redirect me to a link or tutorial which help me
i can not understand the reason
thanks
Mohamed El-Wehishy
|
|
|
|
|
You can't understand the reason for what? You still haven't given any useful information
only two letters away from being an asset
|
|
|
|
|
I wouldn't say that. The original post should have made in clearer, but it does appear to be C# related question. If he/she could only understand what an exception is, we'll all know more.
only two letters away from being an asset
|
|
|
|
|
You're right. While the OP started with SQL in the C# forum, it now figures in the DB forum showing C# code;
and we may be about to find out what the exception is.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Don't you think maybe this belongs in the Database section as opposed to the C# section?
|
|
|
|
|
You should post it to the General Database forum..
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
Hi,
i have RibbonControl.dll, used in my application. but i want to change the base color of this ribbon control. look at this demo project which i have downloaded from codeproject.com itself.
http://www.codeproject.com/KB/WPF/ribboncontrol/ribboncontrol_demo.zip
can any body help me out..
Thanks!
|
|
|
|
|
At the bottom of the article that you got the RibbonControl from, you will see a section for messages. Those messages go directly to the author of the code.
If anyone knows the answer to your problem he/she's the guy/gal.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I feel I should know the answer to this but I rarely use inheritance aggressively and now I'm stuck on a basic concept.
Let's say I have an interface so I can inherit from it from a number of inheriting classes. Each will implement certain functions as defined by the interface. So far so good. Now let's say there is one function that I want to be the same for all inheriting classes. Is it really necessary to implement the function in every inheriting class? Isn't there a way I could implement the function once so that every class which inherits this interface already has the implemented function?
Your help is appreciated.
|
|
|
|
|
You don't inherit interfaces, you implement them. An interface can be thought of as a contract, it dictates to a class what methods, functions and actions it must make use of.
|
|
|
|
|
Good, I didn't want to have to say that again.
|
|
|
|
|
I figured by his post he still doesn't grasp this concept, which is understandable from a beginners point of view. Especially if he came from Java. Hopefully, it's the last time.
|
|
|
|
|
Doesn't Abstract class does that?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|