|
Message Closed
modified 11-Mar-13 10:57am.
|
|
|
|
|
No, Run test is just an example of how to use the other two methods...
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
And always use parameterized queries.
And don't put the data access code in the even handler -- write a Data Access Layer.
And what if multiple users have the same password?
Plus your app will be "more professional" if the state of btnSave.Enabled is controlled by the TextBoxes.
|
|
|
|
|
I'm trying to launch a URL from my desktop app. I know I have done this before:
System.Diagnostics.Process.Start("http://www.microsoft.com");
Process hangs on this line. Is this some kind of new Windows 7 security issue? I have UAC disabled and am admin on my box.
if I type "start http://www.microsoft.com" from the cmd line, it works fine, so the browser is correctly registered and works as expected.
|
|
|
|
|
Try
System.Diagnostics.Process.Start(@"http://www.codeproject.com"); (The @-sign!)
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
The url is actually passed in from a string from the object. Dunno why it's hanging on urls. Works fine if I launch say test.doc. Opens up Word.
EDIT: is there some kind of Windows 7 security thing going on?
-- modified 8-Mar-13 15:14pm.
|
|
|
|
|
Try passing a literal pointing to codeproject. If that works, there's something wrong with the string being passed.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Figured it out. On win7 you gotta do explorer.exe as the process and the URL as the parameter.
-- modified 8-Mar-13 20:48pm.
|
|
|
|
|
Eddy Vluggen wrote: The @-sign! Forward slash is not an escape character.
Use the best guess
|
|
|
|
|
It also said to use the literal. Meant as proof that Process isn't broken
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
But it's already a literal.
Use the best guess
|
|
|
|
|
You win
|
|
|
|
|
How many points do I get?
Use the best guess
|
|
|
|
|
i want to detect mouse over on title bar or mouse out from title bar in my c# winform apps. i got a code sample which works but the problem is when i place the mouse on any area of win form then mouse leave occur and when i put mouse on title bar then right event call. actually i want that if i place my mouse on any area of form except title bar then nothing should happen.only when i will place mouse on title bar then a notification should come to me and when i will remove mouse from title to out of my form then label should display mouse out message but if remove mouse from title bar to form body then label should be blank.
here is code. just run this code and tell me what modification i should do to get my expected result. thanks
using System.Runtime.InteropServices;
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
protected override void WndProc(ref Message m)
{
if (m.Msg == 0xA0)
{
TrackNcMouseLeave(this);
label1.Text = "mouse move on title bar";
}
else if (m.Msg == 0x2A2)
{
label1.Text = "mouse leave from title bar";
}
base.WndProc(ref m);
}
protected override void OnMouseLeave(EventArgs e)
{
base.OnMouseLeave(e);
}
private int previouseHeight;
private void ShowClientArea()
{
if (this.ClientSize.Height == 0)
this.ClientSize = new Size(this.ClientSize.Width, previouseHeight);
}
private void HideClientAreaIfPointerIsOut()
{
if (this.Bounds.Contains(Cursor.Position))
return;
previouseHeight = this.ClientSize.Height;
this.ClientSize = new Size(this.ClientSize.Width, 0);
}
public static void TrackNcMouseLeave(Control control)
{
TRACKMOUSEEVENT tme = new TRACKMOUSEEVENT();
tme.cbSize = (uint)Marshal.SizeOf(tme);
tme.dwFlags = 2 | 0x10;
tme.hwndTrack = control.Handle;
TrackMouseEvent(tme);
}
[DllImport("user32")]
public static extern bool TrackMouseEvent([In, Out] TRACKMOUSEEVENT lpEventTrack);
[StructLayout(LayoutKind.Sequential)]
public class TRACKMOUSEEVENT
{
public uint cbSize;
public uint dwFlags;
public IntPtr hwndTrack;
public uint dwHoverTime;
}
}
tbhattacharjee
|
|
|
|
|
This would be better posted in the "Windows Forms" forum.
|
|
|
|
|
Hello,
i have a database called power,i'm trying to save data into it.
after insertion the graph is initialised with new values.So everything seems to work perfectly,But when i restart my application i don't find the new value,it's not saved.
powerdbDataSet db = new powerdbDataSet();
this.powertableTableAdapter.Fill(db.powertable);
chart1.Series[0].XValueMember = "time";
chart1.Series[0].YValueMembers = "power";
chart1.Series[0].IsVisibleInLegend = false;
powertableBindingSource.DataSource = db.powertable;
powertableTableAdapter.Insert(60, 60);
Thank you for your help.
|
|
|
|
|
I suggest that you are only updating the values in your table adapter but the table adapter does not store the data into the database - the data stays in the memory (table adapter). There must be a method to force the table adapter to update the database - Don't ask me how it is called exactly but you might want to have a look into the corresponding MSDN article[^].
|
|
|
|
|
i had a look on it,and tried update(database),and update(datatable) but it does not work.when i look to my database after mofication ,i don't find the new entry.
|
|
|
|
|
Is youre database file-based, like Access?
If so, are you copying the balnk database from your project to the bin folder every time you build?? This is usually the case when an Access database is used and is part of the project as a Content file. These files are recopied to the build bin folders every time you recompile the project, thereby overwriting the data your wrote in the last pass.
|
|
|
|
|
i create a database using visual studio .mdf
|
|
|
|
|
As Dave said, it is quite possible that your .mdf file is being recopied from your source directory to your bin directory when you rebuild your project. Check the properties of the file in Visual Studio and make sure Copy is not set to "Copy always". You should also check the code where you do the Insert or Update commands.
Use the best guess
|
|
|
|
|
Hi,
I know the functionality of Abstract Class & Interface.
But, in which situation i can use this.
Consider I am starting a new project and I need to design and create a class. So here in which situation I should create AbstractClass or Interface. How to find out which is suitable for particular situation.
Please give me some practical situation where I can use and where I can't.
krishna
|
|
|
|
|
If you need the actual implementation of some functionality to be the same, you would consider an abstract class. If you only need the contract to be the same or you need to do something that looks like multiple inheritance, use interfaces.
|
|
|
|
|
Hi Mr.Pete
Even I can use Interface for the common functionality, correct me if I am wrong.
krishna
|
|
|
|
|
Sorry to steal Pete's thunder.
You can't use an interface for the implementation of common functionality, all an interface does is define what is available not how it is actually achieved. Lets take a simple example, modelling a cats which can for simplicity only look around or make a noise the Interface would look like:
public interface IFeline
{
LookAround();
MakeNoise();
}
OK, lets say I want to model a Tiger and a Cat. Both Implement IFeline, both look around in the same way, but a cat purrs but a Tiger roars. LookAround is common to both and should be in a base class. I don't ever want to create and instance of the base class, so I create an abstract one which encapsulate what is common:
public abstract class Feline: IFeline
{
public LookAround()
{
Console.WriteLine("Looking");
}
public abstract MakeNoise();
}
Now I can implement the differing functionality:
public class Cat: Feline
{
public MakeNoise()
{
Console.WriteLine("Purrr");
}
}
public class Tiger: Feline
{
public MakeNoise()
{
Console.WriteLine("Roar");
}
}
Hope this helps!
|
|
|
|