|
Firstly thanks for your reply Luc, I appreciate it. Now, there must of been some confusion, I guess I didnt state it correctly.
The COM error that I showed here is an error I got when my code was (apparently working, besides that run-time error) and I seeked online for suggestions on possible solutions and I came across that the program needs Full Trust for it to work. So I changed the project to full trust in project settings and yet the error still persisted. I was able to run the program at this point.
I was then stumped, had no idea what to do until I saw that my main class 'PenDriveBackup' (which resides in Main.cs) had the modifiers 'public partial'.
So the class looked like 'public partial PenDriveBackup : Form'. I removed the partial from the class and went into my Main.Designer.cs where I removed the partial from that class too which then went from 'public partial class PenDriveBackup' to 'public class PenDriveBackup'.
Upon doing this the error, "Error1 The namespace 'PenDriveBackupProgram' already contains a definition for 'PenDriveBackup'" occurs unabling me to compile and that is the current state im in.
My project consists of five items;
Main.cs -> Where most of my code sits.
MessageBoxForm.cs -> Custom message form, used to determine either incremental or full backup.
InputBoxForm.cs -> Custom input box, used to determine where the user wants to backup.
USBSerialNumber.cs -> A class file downloaded from the internet.
And ofcourse, Program.cs
Using the Find function I managed to see which items included the class PenDriveBackup.
Main.cs -> One class, being PenDriveBackup
-> Main.Designer.cs -> A class in here is called PenDriveBackup but as it belongs to Main.cs it can't be the problem?
MessageBoxForm.cs -> Found no class called PenDriveBackup
InputBoxForm.cs ->; Found no class called PenDriveBackup
USBSerialNumber.cs ->; Found no class called PenDriveBackup
I hope I have provided suffecient information to help you, I have been tearing my hair out for the last few days.
Oh and something that may help, if I were to build the USBSerialNumber.cs form in its own project it works. Thats why I thought the modifier partial was causing the problem.
Thanks again Luc!
|
|
|
|
|
OK
1. initially a C# class had to reside in a single file; which also meant Visual Designer, which actually generates code, was modifying your form's C# source file. Then they introduced the notion of partial classes, which means you add the partial keyword to a class, and now can split the class over several files. Since then, Visual Designer has its myForm.Designer.cs file which you shouldn't touch, and you have your myForm.cs file which VD won't touch; they both contain a "public partial class myForm" statement, and the compiler understands the two or more parts have to be joined together to create one class. When you remove the "partial" keywords, that no longer works; the compiler now sees two different classes with the same name, and rightfully complains. You have to reinstate the partials.
2. I don't know about your original problem; I'm not inclined to go with the "full trust" issue.
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? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
FWIW: Here[^] is the thread mentioning a context problem I read earlier.
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? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
Thanks once again for your Reply Luc.
I have now fixed the code in regards to the partial modifier and I understand how that works now. I can compile my project yet the runtime error still persists ofcourse.
Looking at the link you gave me it looks as though the problem is something related to a thread however I do not explicity state any threads in my project thus im confident when I say no threads are being used.
In regards to the AppartmentState I also am not using this.
Thanks George.
|
|
|
|
|
i hear that there 's classes for replication in vs 2008
i need that classes and simple example for it
becuase iam in case which can't replicate direct from sql server
i need help
thanks
md_refay
|
|
|
|
|
Hello,
I'm developing my own custom control that is essentially a form with a custom scroll bar, with several command buttons at the bottom of it that will modify the contents of the form. However, when you click these command buttons, it needs to run a sql query which may be slow. Thus I would like some sort of loading screen while it performs the queries and updates the form content. How would I go about doing this? Thanks!
|
|
|
|
|
It's simple, display a messagebox
only two letters away from being an asset
|
|
|
|
|
Do the query in its own thread?
|
|
|
|
|
And how does this answer the question of how to display a loading dialog ?
only two letters away from being an asset
|
|
|
|
|
I would like one of those ajax like spinning icons in a modal window on top of the panel. How is this possible?
|
|
|
|
|
There is nothing particularly difficult here. Create a dialog with the animated gif, display it modally.
only two letters away from being an asset
|
|
|
|
|
Dear Sirs,
I have used Netbeans and Eclipse IDEs, and they have a nifty feature such that while you're typing a string literal, you can press enter, and it automatically inserts end quotes, plus sign, the appropriate tabs, then beginning quotes so that if I type
if (flag)
string str = "There was an error in the output, you must first [enter]type 't', then the input.";
, the output is thus:
if (flag)
string str = "There was an error in the output, you must first " +
"type 't', then the input";
Is there an analogous feature in Visual Studio. Now, I have to type the end-quotes, the plus sign, enter, and the beginning quotes, and it gives me the red-squiggly the whole time.
Thanks for your responses.
In Christ,
Aaron Laws
http://ProCure.com/
|
|
|
|
|
Hi,
no, I don't think there is.
FWIW: your example doesn't make sense, str is unused and out of scope right away.
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? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
Dear Mr. Pattyn,
Yeah, you HAVE to put things like this in your code all over the place, so that you can put out another version in a few months which is `optimized.' You must be novice.
In Christ,
Aaron Laws
|
|
|
|
|
No, he's no novice. What he commented on was your example. You declared a variable in the True side of teh if statement and didn't use it for anything.
He knows full well that the quotes and + sign is required as described in your question. No, there is no equivilent in Visual Studio. But, it sounds like a perfect opportunity for you to create a plugin to do it.
|
|
|
|
|
LimitedAtonement wrote: You must be novice
Yes I'm learning new stuff every day.
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? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
Dear Sirs,
Oh!! I was wondering why my message didn't seem to hit its mark properly -- I meant to put a wink in there after `novice'!! I'm just kidding! Now I see that the wink was edited out...how do I get a little smiley face in the text? Sorry if this was taken wrong.
In Christ,
Aaron Laws
http://ProCure.com
|
|
|
|
|
Hello Everyone, I am trying to add some components with my App. What it should do is during installation the App should ask user to create userName, password,and put the organization name that will use this App.
Since this is for the first time I am trying to deploy a project I do not have much knowledge about it. If some one be kind enough to help me that will be great.
Thaks
|
|
|
|
|
Have a look here[^]
only two letters away from being an asset
|
|
|
|
|
Hi Mark,
thanks for your reply. that is helpfull. Since I am rew to this that is why I need to little more time to absorb it. when user enter UserName, and Password How do I get it and save it in a file so that when the user want to log onto the App and get access to it using the same passwrod and user nanme.
Please forgive me if I miss read anything form the artical.
thanks.
|
|
|
|
|
|
I have used a dictionary before in the form of Dictionary<tkey, tvalue=""> but is it valid to use it like this, Dictionary(TKey, TValue, TValue), if not what is the best way to do this or a good alternative.
Thanks
|
|
|
|
|
What you are asking for is syntactically illegal in a .net Dictionary .
Formally a dictionary key directly maps onto the value (but not necessarily the reverse), and only one instance of key can exist per dictionary.
What you need to do depends up what you are trying to acheive, if you give more information I might be able to provide more help.
CCC solved so far: 2 (including a Hard One!)
|
|
|
|
|
I am reading in a txt file, and pulling out a drive name(string), start time (float), end time (float) and maybe a date in the future but not using that just yet. These will need to be stored. There will be more than one start and end time per drive. Once the data has been read in and stored I will need to then read the data back to make a graph out of the data.
Hope this is clear.
Thanks
|
|
|
|
|
You can use more complex types in a Dictionary, so you could have a Dictionary<string, List<float, float>> here.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|