|
|
Albarhami wrote: Try to handle it with dock property
The dock property has nothing to do with the task bar. It just handles if a control is docked on one side of it's parent.
------------------------------
Author of Primary ROleplaying SysTem
How do I take my coffee? Black as midnight on a moonless night.
War doesn't determine who's right. War determines who's left.
|
|
|
|
|
If you have a Windows Form application here, it means one of two things - one, the taskbar is set to autohide, or two, you have code in the application that's designed to run the application full screen.
|
|
|
|
|
Are you properly setting the MDiParent property of each child window to 'true ? Once you have set that property: the setting of 'ShowInTaskBar for MdiChild Forms has no effect.
See Pete O'Hanlon's reply above for other things you should check on.
And, also, if you are using Windows 7, there have been many bug reports to Microsoft about the Main TaskBar stuck on Visible, and not hiding, when its AutoHide property is set to false: I have this problem, at times myself, and have reported it: but I have never heard of anyone having a problem where the Main TaskBar was "stuck" on "closed."
best, Bill
<color>"When it comes to atoms, language can be used only as in poetry. The poet, too, is not nearly so concerned with describing facts as with creating images." Niels Bohr
|
|
|
|
|
Some One Plz Help Me
When i Am trying to Restore a database it gives me error-
System.Data.SqlClient.SqlException: Logical file DB_Jaggry is not part of database DB_Jaggry_Restore&. Use RESTORE FILELISTONLY to list the logical file names.
RESTORE DATABASE is terminating abnormally
private void button1_Click(object sender, EventArgs e)
{
BackupDB(@"C:\TempDB_Jaggry.bak");
RestoreDB(@"C:\TempDB_Jaggry.bak", "DB_Jaggry_Restore");
}
Code fro Backup-
public static void BackupDB(string backupDestinationFilePath)
{
try
{
Backup backup = new Backup();
backup.Action = BackupActionType.Database;
backup.BackupSetDescription = "BackupDataBase description";
backup.BackupSetName = "Backup";
backup.Database = "DB_Jaggry";
BackupDeviceItem deviceItem = new BackupDeviceItem(
backupDestinationFilePath,
DeviceType.File);
backup.Devices.Add(deviceItem);
ServerConnection connection = new ServerConnection();
Server sqlServer = new Server(@"SNEHA-PC\SQLEXPRESS");
backup.Initialize = true;
backup.Checksum = true;
backup.ContinueAfterError = true;
backup.LogTruncation = BackupTruncateLogType.Truncate;
backup.SqlBackup(sqlServer);
MessageBox.Show("Backup operation succeeded");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
Code For Restore-
public static void RestoreDB(string backUpFilePath, string databaseName)
{
try
{
Restore restore = new Restore();
restore.Database = databaseName;
restore.Action = RestoreActionType.Database;
restore.Devices.AddDevice(backUpFilePath,
DeviceType.File);
restore.ReplaceDatabase = true;
restore.NoRecovery = false;
restore.RelocateFiles.Add(new RelocateFile("DB_Jaggry",@"C:\Temp\DB_jaggry.mdf"));
restore.RelocateFiles.Add(new RelocateFile("DB_Jaggry_Log",@"C:\Temp\DB_Jaggry_Log.ldf"));
ServerConnection connection = new ServerConnection(@"SNEHA-PC\SQLEXPRESS");
Server sqlServer = new Server(connection);
restore.SqlRestore(sqlServer);
MessageBox.Show("Restore operation succeeded");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
Thnk u In Advance...
|
|
|
|
|
What did you get back when you tried RESTORE FILELISTONLY to list the logical file names? Did that list include the file you're trying to restore?
Will Rogers never met me.
|
|
|
|
|
I’m working on a special project over the next 6 weeks while I recover from surgery. I’m trying to teach an old style C++ developer (me) new tricks using C#!
I’m looking for advice and some helpful links on how to convert a console based C++ program of mine to C#. I can go into the detail of the project, but it is fairly large and that would take us down the wrong path. I’m basically looking for some general information here.
My first thought on this is to create 3 separate solutions within one project.
The first would be a DLL that does all the work and returns the “feedback” (what it did and did it do successfully or have problems it had, etc.) back to the main process in the form of a string to be displayed.
I’ve never written a DLL, so this is a first for me also!
The second solution would be a windows form which can be used to set up the various calling parameters for calling the DLL to do its work …
And the third would be a console based application that would use the same DLL interface.
I’m using http://apex.vtc.com/ms-c-2008.php as a tutorial for learning C# and should be finished with the free stuff tomorrow at which time I will start paying my monthly fees until I have everything working properly. I’m using VS 2008 Professional Edition because that is what in loaded on my home PC.
Does this sound like a reasonable approach?
Where can I get a good tutorial on how to write a DLL and how to create bi-directional communicate with it?
Thanks in advance for any feedback and pointers you can offer.
|
|
|
|
|
I know it's probably more complicated than I understand, but to me a dll is just a library of functions that you add to your class with a using statement. In C# I believe you create it as a class library, then use the class member methods in your form or console app to accomplish useful things. Keep in mind, of course, that as a programmer I'm a complete idiot, barely functional, but I do manage to make things I need to have work somehow. I could be giving you bad advice, but it seems to me that you might want to create a class library to hold all the useful functions you use in multiple places, a Windows Form for the user interface, and a "something else" that actually controls all the interactions. The GUI part should really only handle display and input, then pass inputs to something else for handling, and respond to events for things that need to be displayed. Your class library would contain the functions that do all the heavy lifting.
In website development, there's a model called MVC - I don't know if it's applied to desktop apps, but I see no reason not to. I once reviewed a book on the subject, and got a free copy of the book when it was finally published, and I was much impressed by the logic of this approach. Your Model (M) would include the class library with all of the workhorse bits, the View (V) would just accept input and display results, and your Controller (C) would contain the state machine and event handlers that make everything happen. To my thinking, this would save you some work, as the command line version of your app could actually be the Controller, using a constructor that accepts the initial inputs on the command line, instead of being provided by your GUI interface. C# allows multiple constructors, so long as the signature is different for each, IIRC.
Of course, I could be leading you astray, being just a hobbyist who will never be an expert, as the majority of our members are. But that's the way I'd tackle it, then if I was completely wrong I'd come back here and beg for help. If it makes sense to you, give it a try... Good luck, and you might have the beginnings of a good article here. Keep that in mind...
Will Rogers never met me.
|
|
|
|
|
using statements just allow you to elide the namespace name when you're typing a class name. To add a library to the available classes, you need to reference it: Add Reference to the project in an IDE, or use /r with csc.
|
|
|
|
|
Roger Wright wrote: In C# I believe you create it as a class library,
Just to note that that is in fact exactly what it is called at least in Visual Studio.
|
|
|
|
|
You can create a dll by choosing Class Library in the project menu. Think of it as a group of namespaces or something, a whole set of functionality put together and that is reusable for other applications or other assemblies in your application.
However, a dll itself will not do something, you'll need an exe file which will be created if you choose the console or winforms/wpf projects, and then add a reference to use the dll. If you're totally new, start with a winforms and later move on the wpf.
For a first time I wouldn't search too far to hook up an application with an assembly, but basically there are three ways.
1. select one from your current solution
2. select one from the hard drive somewhere (optionally with a local copy or not)
3. If the assembly is added to the GAC, select it from there.
Just start out with 1.
You can also download VS2010 Express which is free (you'll need to register, but it's free) and SQL Server Express as well if you need it. (also free)
You can use MSDN[^] to find information on the objects and its members and this site [^] for more advanced help
Hope this helps somewhat, come back if you have specific questions.
good luck.
V.
|
|
|
|
|
I think you are looking at this from the wrong perspective. You have decided that you need a DLL without really understanding what a DLL is or how it would help to solve your problem. You say that you are converting a C++ console program to C#, so presumably the basics will be exactly the same, unless you are going for a completely new design. Look at your inputs, outputs and user interfaces first and decide how they should fit together. It may well be that a single executable written in C# will satisfy all the requirements.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
PapaGeek wrote: Does this sound like a reasonable approach?
Yes.
You should do the following
1. Design the API. That is what the dll exposed.
2. Code the dll, implementing the API.
3. Create the console, it does console output and uses the API.
4. Create the form.
PapaGeek wrote: and how to create bi-directional communicate with it?
You just write classes/methods that you will use. If you want to get fancy then you can play with the 'internal'. Those go in the library as the API.
Then you use those in console/form.
|
|
|
|
|
PapaGeek wrote: Thanks in advance for any feedback and pointers you can offer.
This is C#, you don't have to worry about pointers.
|
|
|
|
|
Your C# program can use the same DLL as the C++ program.
Using a DLL from C# is even easier than using it from C++: Just use the DllImport directive:
http://msdn.microsoft.com/en-us/library/aa984739%28v=vs.71%29.aspx[^]
The above example doesn't show the mangled C++ name you need in a DllImport directive, so here's a working example from my code:
[DllImport("vdrdll.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = @"?setNumObjects@@YAXH@Z")]
static extern void setNumObjects(int num);
You get the mangled name from the *.exp file that's created when you compile the C++ DLL. The mangled name always starts with '?' and ends with 'Z'.
The second line is just the standard function signature.
Your C# program needs:
using System.Runtime.InteropServices;
at the top so it recognizes the DllImport keyword.
"Microsoft -- Adding unnecessary complexity to your work since 1987!"
|
|
|
|
|
Another tip: Read "Effective C#" by Bill Wagner, 2nd edition.
It gives you more information about coding in C# than just an introductory C# language book. The 2nd edition covers .NET 4.
"Microsoft -- Adding unnecessary complexity to your work since 1987!"
|
|
|
|
|
I need to create time slots using start time and end time as 8 to 5 with 20 minutes intervals, getting the start and end time from a table in a database dynamically and once the slots are created I need to save them in another table. Any suggestions.
Thanks
|
|
|
|
|
Well, you could use a loop, a list of DateTime items, and a method on the DateTime class to add some minutes. Then you'll need to do some data base work.
|
|
|
|
|
I have implemented the "Sieve of Eratosthenes" algorithm in c# to find prime numbers below 2,000,000. The execution takes very time. How can I improve my implementation?
Here is my code:
public class Number
{
private int _Value;
private bool _IsPrime;
public int Value
{
get { return this._Value; }
set { this._Value = value; }
}
public bool IsPrime
{
get { return this._IsPrime; }
set { this._IsPrime = value; }
}
public Number(int value)
{
this.Value = value;
this.IsPrim = true;
}
}
List<Number> numbers = new List<Number>();
for (int i = 2; i < 20000000; i++)
numbers.Add(new Number(i));
for (int i = 0; i < numbers.Count - 1; i++)
if (numbers[i].IsPrime)
for (int j = i + 1; j < numbers.Count - 1; j++)
if (numbers[j].Value % numbers[i].Value == 0)
numbers[j].IsPrime = false;
Meysam
modified 12-Sep-12 17:18pm.
|
|
|
|
|
You have a typo in the definition of the numbers variable. For your code to even compile that would need to be List<Number> numbers = new List<Number>()... , but I can't help but think that this will be very inefficient.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Your code would not even compile, so how can you say it is slow:
List<Number> numbers = new List<Number>() { 2, 3, 4, 5, 6, ... , 2000000 };
for (int i = 0; i < numbers.Count - 1; i++)
if (numbers[i].IsPrime)
for (int j = i + 1; j < numbers.Count - 1; j++)
if (numbers[j].Value % numbers[i].Value == 0)
numbers[j].IsPrime = false;
Regards,
— Manfred
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
|
|
|
|
|
if you mean this:
List<Number> numbers = new List<Number>() { 2, 3, 4, 5, 6, ... , 2000000 };
it is not the real. I was going to say that I have an array from 2 to 2,000,000.
I just edited the question.
Meysam
|
|
|
|
|
Which part did you edit. The code still is not valid. If you don't use an array or a list of Number instances your algorithm will not compile since you are accessing IsPrime and Value in that loop.
Your code is still broken.
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
modified 13-Sep-12 9:12am.
|
|
|
|
|
What are you talking about?
I have tested my code in some low ranges, and it work great.
It Compiles.
Why you say your opinion when you even didn't try it?
Meysam
|
|
|
|
|
If you post code make sure that the code posted will work.
As your question currently stands the code is invalid for the exact reasons I told you.
In your algorithm you are using the properties IsPrime and Value. For that reason the array or list has to contain these kind of objects. Correct the code you posted!
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
|
|
|
|
|