|
Header files were features that allowed the C/C++ compiler determine what methods a class/file would contain. They didn't necessarily contain any implementation (although some did), but they were included in another file/application using #include so that this could use those methods.
There's no need to do this in .NET. All you need do is add a reference to the DLL that contains the functionality you want to use, add a using statement for the relevant namespace and you have access to all the public methods that class exposes (if your class inherits from it, you get access to the protected methods as well).
"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
|
|
|
|
|
Hello Pete O'Hanlon, Thanks for your reply. Now I know were I am. I will go with .dll this is fine with me.
thanks again.
|
|
|
|
|
Pete O'Hanlon wrote: add a using statement
That is not a requirement -- it's a sign of weakness.
|
|
|
|
|
I agree with Pete, of course.
I would like to add my suggestion to buy a book on C# and study it. It is the most effective and efficient way to learn the language; experimenting is fine, and necessary, but by itself it is no guarantee to becoming a good and productive C# programmer.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Hello Luc Pattyn, I could not agree more with you. I believe in teaching someone how to catch fish not catching for them.
I have question to you since you have worked on embedded system. I am currently working on windows CE 6.0. I already build the OS. Now I had a application written in VSC++ for desktop. I need to convert it to C# and deploy it on window CE platform( create a smart device application from scratch ). Do you have any suggestion for me besides reading a book (I will read any book necessary regardless).
|
|
|
|
|
Sorry, the embedded systems I work with aren't using any Windows. Nor C#.
I do a lot of C# on desktop Windows though.
For C# you will need some .NET framework, probably the .NET Compact Framework 2.0 or 3.5
You could:
- keep some C/C++ code and use P/Invoke to let C# access it; I do it often on Windows XP/Vista, I understand P/Invoke on WinCE/Compact.NET is somewhat crippled. I have a general article in the works here[^], it contains a link (near the end) to the compact version of P/Invoke.
- convert your C/C++ code to managed C++; I would advise against that, the managed C++/CLI isn't all that popular and quite different from unmanaged C/C++.
- do everything in C#; that would be the recommended way, unless you need functionality that isn't present in the framework.
As for conversion itself, depending on size (and the number of authors), I would do it by hand.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Hello All .. I am using net use for accessing network share from my c# code. Couple of times it failed for no reason (return code 2) & when I ran the same net use command from command prompt it worked fine & after that I was again able to use the c# code. Looked like something was stuck. I am actually deleting the network share & before creating it as its an issue if I try to re-create.
Is there a issue with this or a better way of accessing network share?
Below is code snippet
----------------
string command = string.Empty;
System.Diagnostics.ProcessStartInfo procStartInfo;
System.Diagnostics.Process proc = new System.Diagnostics.Process();
command = "net use " + sharedLocation + " //Delete";
procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command);
procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
procStartInfo.CreateNoWindow = true;
proc = new System.Diagnostics.Process();
proc.StartInfo = procStartInfo;
proc.Start();
proc.WaitForExit();
command = "net use " + sharedLocation + " " + password + @" /user:" + user;
procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command);
procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
procStartInfo.CreateNoWindow = true;
proc = new System.Diagnostics.Process();
proc.StartInfo = procStartInfo;
proc.Start();
proc.WaitForExit();
----------------
Thanks for your help!!
|
|
|
|
|
Hi. I have the code below which I am using to upload files to my ashx page. It works great, although I cant seem to find a proper way of getting how much it has transferred.
the calling code:
WebClient wc = new WebClient();
wc.OpenWriteCompleted += (s2, e2) =>
{
PushData(e2.Result, offset);
e2.Result.Close();
};
wc.OpenWriteAsync(ub.Uri);
the push data code
private void PushData(Stream output, long offset)
{
byte[] buffer = new byte[4096];
int bytesRead;
bytesRead = theFileStream.Read(buffer, 0, buffer.Length);
if (bytesRead != 0)
{
output.Write(buffer, 0, bytesRead);
totalBytesDone += bytesRead;
FireUpdateEvent(bytesRead);
}
}
The above code is slightly different to my actual code, for brevity sake.
Now, I had presumed that when it gets to output.Write(buffer,0,bytesRead); that that was the point where it sent the actual data and it would lock up and only goto the next line once its finished writing that section. But it goes on to totalBytesDone += bytesRead; before its written anything to the server. I presume the reason is that its doing the writing in a seperate thread in the background(or im actually looking at the wrong section of code and it writes somewhere else) - but for my totalBytesDone code to work i WANT it to lock up until its finished sending(i can put this all in a seperate thread later).
Ive downloaded tons of examples for doing this and they either dont work properly with my ashx file handler(i cant change it) or they use a WebClient method that just reports on 50% progress.
Please help, this is urgent.
Thanks
Strive to be humble enough to take advice, and confident enough to do something about it.
|
|
|
|
|
I am working on winforms i have a datagrid in which i m using autocomplete feature. I am not able to find out how to restrict the user to select data from only autocomplete source. Means the data should be in autocomplete source list. i am using datagrid textbox field (not combobox). if user tries to write data other than auto complete source then i have to restrict it. Can any body help i am totally stucked here.
Regards
Narendra Singh
(Jindal Tech Ventures)
|
|
|
|
|
Hi,
I have made a C# forms application. In there i use a usercontrol that dynamicly puts a list of checkboxes onto the usercontrol. Next to the checkboxes is a scrollbar. If you move the scrollbar the checkboxes will be set onto the selection that is pointed out by the scrollbar. So the Text and Checked state of the checkboxes get updated to the position in the entire list. (in short, i've made my own ListBox with checkboxes)
My problem is that i cannot capture the scroll event of the mouse from checkboxes(using the hardware scrollbutton). The scroll event of the usercontrol itself doesn't get triggerd because of the checkboxes are on top of it. And the checkboxes itself do not have a scroll event.
How can i solve this?
Greetz Willem
|
|
|
|
|
If I have interpreted your question correctly, you are saying that using the scrollwheel on your mouse does not cause the panel to scroll. If I have misunderstood then please disregard the rest of this message.
There are several controls in Visual Studio that suffer from this problem. Sometimes, but not always, this is caused because the control does not have focus. The solution in those cases is to handle the MouseEnter event to give the control focus.
private void myUserControl_MouseEnter(object sender, EventArgs e)
{
myUserControl.Focus();
}
If this doesn't work immediately, then I am probably wrong about the cause.
Good luck!
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.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.
|
|
|
|
|
This was my first solution and it doesn't work. When i do this my usercontrol will get the focus(the mouseenter event gets fired), but it doesn't fire the scroll event after that. I think this is because the checkboxes override the foces when hovering over it, I think this because the checkbox "lights up" when you hover over it(I use windows 7).
So i think you understood my question right, but the solution doesn't work.
|
|
|
|
|
OK. Sorry. Keep trying though.
BTW: I assume that you are aware the there is a built in CheckedListBox Control?
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.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.
|
|
|
|
|
Well acually, i did not know that;) (kinda new in .NET Forms, the last forms application was Visual C++ 6, MFC)
But there is a sophisticated system behind the interaction between the checkboxes in the list, if i want to convert that to a listcontrol it would take me some time, while the listbox i created now works exactly like i want, with the minor problem of scrolling.
I also want to know how to properly solve this issue for future usage.
Converting would be my last hope;)
|
|
|
|
|
Maybe what it takes is you also executing Henry's myUserControl.Focus(); every time your mouse wheel actions cause the checkbox states to change. Whether you also do it after a manual checkbox state change (a click) is up to you.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
This also doesn't work... The checkbox mouseenter event gets triggerd, sets the focus to the usercontrol, but no scroll event is triggerd after that.
|
|
|
|
|
then I don't have the answer.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
hi,
i have a developer team work on project with VSS, i defined the users but i want to disallow this user to unpin files..
how i can do that??
thax all
|
|
|
|
|
You can't by default - VSS assigns rights to the following operations only:
Read
Check out/in
Add/Rename/Delete
Destroy
"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
|
|
|
|
|
Hello,
I am creating a website for my father. It is for his new magazine and he asked me i've I could create a contact form.
So his customers can ask questions to him or give feedback.
And i really don't know how to create something like this. I have read some tutorial's but they didn't help me well.
At the moment i have something like this but probaly this is wrong.
<code>
MailMessage contactMail = new MailMessage();
contactMail.From = new MailAddress("txtMail.Text");
contactMail.Subject = "Hallo! Test 01";
contactMail.Body = "<p>Body</p>";
contactMail.IsBodyHtml = true;
I hope some one can send me a good 'How to' or anything that will help me.
I would be very thankfull!
Greetings,
Bas
|
|
|
|
|
|
I want to have the number as ##9.9 only if there is a decimal point but if it's 0 then it should be ##0? at the same time I want to round to upper so it should 57.3 if it's 57.3 but it should be 58 if it's 57.6
|
|
|
|
|
That isn't easy, mostly because your requirements conflict:
How should 59.9 be printed?
Your first requirement says "59.9", but your rounding says it should be 60.
Decide exactly what you want to do, and try again!
I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in.
Apathy Error: Don't bother striking any key.
|
|
|
|
|
if I correctly understand your post
double i = 11157.0;
Console.WriteLine(i.ToString("#.#"));
else clarify it plz
|
|
|
|
|
if your formatting isn't one of the built-in ones, just write a method ("MyToString()") that formats it any way you like; and don't hesitate to use as many statements as you need to get it done. Then use your method everywhere it applies.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|