|
Adam Maras wrote: No hard feelings
Certainly not, I appreciate the effort, your answer took more work than I am usually willing to invest. But then I answer a lovwer level of question
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I want to make an application that when I'm with the mouse on it ... it sets the opacity to 100 ... and when the mouse is .. outside the form.. it sets the opacity to 50
THE PROBLEM IS that the code...is working when the mouse is over the content of the form... it does not include the border of the form or the form controlbox(min,max,close) ... don't know why
I've managed to make something like that with a timer set to 100 and with this piece of code:
If Cursor.Position.X >= Me.Left And Cursor.Position.X <= Me.Right Then
If Cursor.Position.Y >= Me.Top And Cursor.Position.Y <= Me.Bottom Then
mouseover = True
Else
mouseover = False
End If
Else
mouseover = False
End If
Please help with an idea .. Thanks
|
|
|
|
|
...and do NOT spam multiple forums with the same question. You posted VB.NET code, so stick with the VB.NET forum. In fact, posting VB.NET code in a C# forum is pretty close to a cardnial sin. Be prepared to get flamed.
|
|
|
|
|
VbCodeDetectedException, thread aborting
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 am migrating a C++ application to .NET.
In C++ ,I have an template class which uses some ATL library classes
for eg.
template< class T >
class MyBaseClass:
public IConnectionPointContainerImpl<t>,
public IPersistStorageImpl<t>,
public IPersistPropertyBagImpl<t>,
{
}
Now i need to use this call in my new C# .net project where my new .NET call will get derive from above MyBaseClass .
Please let me know how can i archive this ???
Is this possible to use a template class which uses some ATL libraray classes directly in C# ?
`chiman
|
|
|
|
|
You can't.
You'd have to write a C++/CLI wrapper aroudn your class and use that in your C# app.
|
|
|
|
|
Hi,
I need to control my progressbar inside a thread by invoking it on GUI thread, otherwise the GUI may lock for a short time which is really disturbing. How can I change the Value property of a progressbar with invoking it.
Thanks in advance.
|
|
|
|
|
the thread-and-control stuff is the same for all kinds of Controls.
This[^] may help a bit.
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!
|
|
|
|
|
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?
|
|
|
|