 |

|
The_User_Clicked_A_Button_Called anInstnace = new The_User_Clicked_A_Button_Called(); That's how you declare an instance. In order to call the method using an instance, the method must NOT be static. As far as mastering the concepts behind C#, I would really recommend this[^] book.
[Edit note]Please change your class and method names to be less cumbersome. You'll thank me in the long run.
|
|
|
|

|
You have a set of extra parenthesis in there pete.
|
|
|
|

|
Cheers mate - it's such a stupid class name, I just copied and pasted it from my original answer. I should have checked what I picked up there.
|
|
|
|

|
I second that book recommendation.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|

|
This is actually meant as a comment.
It appears that you are using a very non-standard naming convention in your code. This actually makes the code much more difficult for a another developer to read as we all become accustomed to specific casing and naming methodologies. It's all good if this is just something you are writing for yourself, but habits are hard to break and if you work on commercial code with naming schemes like this, you may run into some developers who won't take kindly to it.
You should take a look at Camel Casing[^]. This is the most common way that CSharp developers write code, and if used correctly will be much appreciated by other developers who will have to look at your code sometime. I have taken the liberty of taking one of your methods above to show you what I mean. Cheers.
namespace GeorgeWashington
{
public class TheUserClickedAButtonCalled
{
internal void StartDataCommand04()
{
UART.send_command
( ProtocolPackets01.BARN_Command04StartDataFlood,
0,
ProtocolPackets01.BARNCommand04StartDataFlood.Length
)
;
}
}
}
I wasn't, now I am, then I won't be anymore.
|
|
|
|

|
Just read your suggested webpage.
If the underscores are annoying, then I'll do my best to remove them and Smush the words together.
My vocabulary now includes the phrase CamelCasing.
Oh, and thanks for the input.
|
|
|
|

|
Hi.
I have an application that store PDF file in a library and do some other stuff like filtering, searching ...
what i want to do is the next:
when the user hit any pdf file in the windows explorer with the left mouse button, I want to add a menu item to that context menu (of the operating system)"Add this book to library for example", so that i can add this file to my app data base without openning the whole application,(using another sub program that took the path of this file).
is there any way to do this please using C#.
|
|
|
|

|
"The Operating System"?
This is hard enough in Windows, let alone you venture out to other platforms! Extending the system is not what a typical application does, hence it's not part of the framework. You'd need to write a Shell Extension[^], which has become a bit harder since the introduction of 64-bit machines.
|
|
|
|

|
Thanks Eddy Vluggen, that was very helpfull.
|
|
|
|

|
You're welcome
|
|
|
|

|
I'm new to writing code of any sort. I'm taking classes to eventually be a .NET SharePoint designer.
1. Do any of you have tips regarding what I need to remember and what I can simply pull up from Visual Studio?
2. Do any of you have suggestions regarding the best way to begin remembering code? 3x5 cards, etc...?
3. Any suggestions regarding websites to access, good video's, etc... to help with my learning the necessary?
Thanks!
Maurice
Maurice Lantier
Fort Worth, Texas
|
|
|
|

|
Maurice Lantier wrote: 1. Do any of you have tips regarding what I need to remember and what I can simply pull up from Visual Studio?
What's "pull up"? Usually the answer is "when I press '.'", which should be Ctrl-Space. Intellisense shows the available types in the currently loaded namespaces, as available in the currently referenced assemblies. Most members of those types are available, along with any XML-documentation and a reflection of the parameters, and and indication of any overloads.
Maurice Lantier wrote: 2. Do any of you have suggestions regarding the best way to begin remembering code? 3x5 cards, etc...?
Memorizing isn't going to help, you'll need to experiment. A lot.
No, I really mean a lot!
Maurice Lantier wrote: 3. Any suggestions regarding websites to access, good video's, etc... to help with my learning the necessary?
This site, MSDN and Coding4Fun would be my top three; problem is, first is a community, not a school; second is a reference-site, not a manual, third is too complex often to use it for starters.
|
|
|
|

|
By "pull up" I WAS indeed referring to intellisence. Thanks for your tips... I will use them and any other's that I receive.
|
|
|
|

|
It couldn't have been the Help-file (available under F1). You obviously have internet, so that's your primary resource - CodeProject and MSDN. The first is the ideal starterplace for new projects, the articles provide a nice basis for new applications, and the forums are usually open. The second is the ideal reference, explaining how the building-blocks that are available, look like.
Best recommendation is a good book, not an ebook, but one you can use to kill small animals. Both Manning and O'Reilly offer a nice range of books.
You're welcome, hope that more people respond with something more original
|
|
|
|

|
You should remember the places where you need to look, and where common things are. Intellisense is great when you know what you are looking for, but if you don't know the class name it won't help. For example, a C++ or Java person might try looking for 'Map', and the autocomplete will fail them completely – but knowing that you can find collections under System.Collections.Generic will give you the clues you need.
You also need to develop Google-fu. C# is a very popular mainstream language, and most problems you're likely to have have been solved and published already, if you can find them. StackOverflow is a trustworthy site if it appears with an answer for your question (I'll take the downvotes for recommending it, it's better than CP in my opinion for small, self-contained questions), as is CP, and MSDN.
The best way to learn depends on your personal style. Myself, I enjoy learning by example so I would get a tutorial or a book and leave that on my desk (virtual or real), and then try creating some simple applications to pick things up. The Framework is too big to learn it academically and expect to hold onto it.
|
|
|
|

|
Sounds like I should learn by doing, doing and doing some more! Good advice! I'll check out the StackOverflow site too.
|
|
|
|

|
A large percentage of my code generally comes from the internet simply because it's both a pain and unnecessary to re-write code that someone else has written and tested. The rest is from writing my own code and adjusting the samples I've found online to fit my purpose. Basically, google-fu
As has previously been said, I strongly advise you experiment. A lot. The best advice I can give you is to code, code and code. It's like learning a musical instrument. You only get better with practice. Make simple projects for yourself and write them. As you get better, you'll find yourself designing better code and reusing functions and classes you've written previously and even get to writing your own code library.
A good book always helps, I feel that "Programming C# 4.0" by Jesse Liberty et al. is an essential desktop purchase. Pretty much the core of the language is clearly explained part by part with a simple example to show you it in use. Jon Skeet's "C# in Depth - Second Edition" will help you better understand what is going on in your programs.
Finally, don't be afraid to experiment and ask for help if you get stuck. We all began somewhere and the majority of people will be keen to help if they can.
|
|
|
|

|
Thanks! I'll check out the books you recommended!
|
|
|
|

|
HI Gurus,
iam new to c#. i need to Design a product home and Login forms using c#.How i will add the individual png files i got for this page design. How to add Click events for the button images.
Please guide me or tell some Videos or Links.
Thanks & Regards,
Rajeev
|
|
|
|

|
Rajeevhyd wrote: How i will add the individual png files i got for this page design
What's a page? If you want a form, please do. Images (whatever format) are linked as a resource. In ASP.NET, you'd simply link to the picture on the server.
Rajeevhyd wrote: How to add Click events for the button images.
Please guide me or tell some Videos or Links.
These are very basic questions; you'll find answers to more of similar questions you'll have in a good book on the topic. I suggest you start in the nearest library, or the beginner portal[^].
|
|
|
|

|
Hi lads and lasses, I have just started looking into communication between services and GUI apps. I decided to use Named Pipes but upon reading a lot of documentation and web examples etc etc it seems that after every message is sent and received you have to setup another server/client to get the next message???
Is this the case? What I wanted was a TCP like connection (yes I know that is an option) where I can set a server listening then connect a client and then through the lifetime of the app just pass messages between the two apps (service and GUI).
Is this possible?
thanks
Nemo1966
|
|
|
|

|
You're not creating a new listener for each and every message.
You would normally create a listener that waits for connections. Once that connection request arrives, you create a pipe server for that client. That way, you can have multiple clients connected to the service at the same time and no interfere with each other.
Now, if you just want the local machine applications to talk to the server, then the service only has to listen for one connection. It doesn't have to spawn a new server object for each incomming connection.
|
|
|
|

|
Thanks for the reply, but the problem is all the examples do spawn a new server object or shut down the server after the first message arrives.
thanks
|
|
|
|

|
You're going to have to point these out because that's not the norm.
|
|
|
|
|

|
Bad example. That one does do what you siad, but it was written as an ad-hoc example to demonstrate the new Pipe classes. It's NOT meant as a tutorial on how to use the classes in production.
That example actually comes straight from the MSDN documentation, which uses very simplistic examples on using specific classes. That example, and many many more in MSDN, is by no means the definitive source on how to properly implement a server using pipes.
An implementation that would look closer to a real-world example is this[^].
|
|
|
|

|
Hi to all,
How can i communicate between Siemens PLC and Visual C# via USB PPI cable as serial communication? When i plug it to my pc so it is identified as a HID device. i want it as com port.(serial pot). how can i achieve this? must i attach any kind of dll to my project? Anyone can help me?
|
|
|
|

|
The driver for the device has to expose the device as a COM port. If it doesn't, you're going to have to go to the manufacturer of the device and either get an updated driver that does this or get a SDK for the device that allows some other method of communication.
|
|
|
|
|

|
I have three text boxes A,B,C.if i enter numeric values in A & B text boxes then i should get product of those values in third Text box automatically . Please tell me the solution and code in C# as soon as possible..
REGARDS
Ameeruddin Syed
|
|
|
|

|
if you are looking at doing this automatically I would have a look at the leave event of the textboxes.
Textbox.Leave[^] event further reading.
you will need to write on of these for both textboxes, and on leave I would check to make sure that the value is a number before performing the addition of the 2 values.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|

|
Message from Member 9550558:
Please i want complete code as per my question
Sorry I have told you in a descriptive way how to do it, in the link I also gave you it had an example of how to use the event, but I am not going to write it for you! I will however help you debug the solution if you have trouble.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|

|
This is one of the reasons I have email disabled.
|
|
|
|
|

|
If you're expecting someone to do your homework for you, you're going to be very disappointed. Class work is where YOU do the work to show that you are learning the concepts presented.
|
|
|
|

|
hello everyone
i want to build a simple metro app private diary using c# please help me guys... i want to give simple calender to the user so that user can pick date and he can go through with editing his stuff.. after he should be able to retrive the content by clicking on particular date. How can i go through please share your vies
|
|
|
|

|
Use the MonthCalendar control. Subscribe to the DateChanged event. When the date is changed, read the content from whatever data storage method you decide to use, be it XML or whatever.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|

|
During my implementation for a client/server application I encountered the follwing problem:
Let's say we have a client application C which is the remoting client and that connect to a Server application S which is the remoting server.
C has two NICs which are both activated.
The problem is when both cards are activated, the client application C is having a hard time establishing a connection with the remoting server S. It seems that the client cannot detect what card to use. Whenever we disable one card, Everything works fine.
Some sites adviced to configure the "bind to" attribute but it does not work.
Note that when running both application on the same machine, no problem occurs. This occurs only when the client and server application are run in different machines.
Does anyone know how to correct this?
Thanks in advance.
|
|
|
|

|
I'm guessing it works on local machine, because it goes direct on looback (127.0.0.1).
I think what you need (not sure) is to add a route. This way you'll be telling whenever I'm connecting to S, use specific gateway.
google "adding route multiple nic"[^]
hope it helps
|
|
|
|

|
Thank you for your feedback. This solution may work but it will not be the best approach. The thing is that we cannot oblige the end users to configure that since that it may affect other applications.
I think that this should be handled in the application level and so on it will be transparent to the user.
Any idea about how to make that configured in .Net Remoting?
|
|
|
|

|
Again, I'm not sure about all this:
- but I think this is a pure low level windows setting/config. Routes have to be configured/added like IP, gateway, mask, mac, etc of both network cards. I don't think this is a per-application domain (but don't hold my word to it).
- there probably is a way to add a route from your .net program, but it probably requires administrative privileges (instead of configuring it manually).
- I think "other applications" are already using a route that is configured right
btw Why are they using dual nic? I'm curious on what is the use case.
|
|
|
|
|

|
Can anyone suggest any good books or tutorials on WPF-MVVM please? I am looking for latest books or tutorials... not the old or outdated ones... Books or tutorials with hands-on or practical examples... Thanks.
|
|
|
|
|
|

|
Alright, I'll admit, after days of looking at this code I'm a bit at my wits end. At a high level it's a project that uses a client server architecture to deliver a stream object via wcf for large data transfers. The blog and project I've utilized can be found here:
http://blogs.msdn.com/b/webapps/archive/2012/09/06/custom-wcf-streaming.aspx[^]
My issue is this, the project works incredibly well with numeric values. But, if I add a few basic string values in, it'll process say 30 rows of data and then die, with the following message:
"The input stream is not a valid binary format. The starting contents (in bytes) are: 08-02-00-00-00-0A-00-00-00-0A-00-00-00-0A-00-00-00 ...
A summarized version of the code looks like this:
Server:
model.ID = i;
model.ParameterOne = i;
model.ParameterTwo = i;
model.ParameterThree = i;
model.AMP = stringCache[i - 1];
formatter.Serialize(memStream, model);
Client:
OrderModel m;
while (s.CanRead)
{
m = formatter.Deserialize(s) as OrderModel;
count++;
Console.Write(string.Format("order ID is {0}\r\n", m.ID));
}
I've run through multiple scenarios. I thought the wcf client was either timing out or being overloaded, but I can run it without wcf all in the same class and run into the same exact issue. I can also manually read and write to a memory stream not utilizing the server class and it works perfectly fine, so that proves it can't be encoding or issues with that data in general.
You can download the same project here (just three classes):
https://skydrive.live.com/redir.aspx?cid=8df0b4ca8325874a&page=self&resid=8DF0B4CA8325874A%21175&parid=8DF0B4CA8325874A%21110&authkey=%21&Bpub=SDX.SkyDrive&Bsrc=Share[^]
If you go to class DBRowStream and comment line 179, it works beautifully. If you uncomment it, it fails after 30 rows. My best guess is that the overriden read method of the class is killing the stream prematurely, but if that were the case, why would a few extra string values mean the difference between it working and not.
I apologize for the novel, and any suggestions or help would be so greatly appreciated!
Thanks so much,
Ryan
|
|
|
|

|
It's multithreaded; could it be that the memorystream is corrupted before the thread finishes?
|
|
|
|

|
You know I was wondering the same thing. Although it's odd that it makes it through exactly 30 rows every single time before it errors out. I was also thinking that because the author switches the memory stream from one of two other memory streams, that maybe the main memory stream is being overridden before a read is complete....
|
|
|
|

|
formatter.Deserialize(s) assumes that the entire object has been successfully written to the stream? For grins and giggle, try writing the entire stream to memory after 30 rows; I bet a dime to a dollar, all of your strings have not been completely written. At least that is what I would look into, don't know the answer myself as I completely avoid WCF like the plague.
|
|
|
|

|
Hi, I am trying to access a MS Access database using Windows form. I added my connection string in App.congig file.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<clear/>
<add name="Constr" providerName="System.Data.OleDb"
connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\XXXX\\Documents\\YYYYY.accdb; Persist Security Info=False;"/>
</connectionStrings>
</configuration>
Code I added in my code to read this is
string connectionstring = ConfigurationManager.ConnectionStrings["Constr"].ConnectionString;
but I am getting following error on this line.
System.NullReferenceException was unhandled
Message=Object reference not set to an instance of an object.
Source=LoadTrackingTool.
I am not getting why I am getting this error. Can anyone please help me out in this. I am new in this functionality.
Thnx,
Aduu
|
|
|
|
 |