|
Why would you want to swap which variable points to which button ? What sort of button ? In a form, or in ASP.NET ? Why ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
You need to understand reference types. While the intrinsics like int , long , byte , char , etc. are value types (they stored the value), other variables you declare (like Button b1 = new Button() ) are reference types:
Button b1 = new Button();
Button b2 = new Button();
b1.Text = "Button 1";
b2.Text = "Button 2";
b2 = b1;
Console.WriteLine(b2.Text); Both b1 and b2 reference the Button originally assigned to b1 . If you set b1 to null , b2 still holds a reference to it. The GC (garbage collector) will clean-up the Button originally assigned to b2 because nothing references it anymore.
Don't forget the importance of reading the docs before jumping into it. It's important to understand the concepts - not just of programming, but programming with the .NET framework and object-oriented development (OOD/OOP).
If you're looking to change the strings, do what you did with the ints, but remember that strings are reference types like most other objects. Being immutable, though, changing the value in the string isn't possible so they store values in a similar fashion as value types, but they can still be referenced by many different variables:
string s1 = b1.Text;
b1.Text = b2.Text;
b2.Text = s1;
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
how do i get the listviewitem text from the form TDSS and pass into the label
TDSS DB = new TDSS();
for(int i = 0; i>DB.CustomerQ.Items.Count;i++)
{
label1.Text = DB.CustomerQ.Items[0].SubItems[0].Text;
label3.Text = DB.TaxiQ.Items[0].SubItems[2].Text;
}
this.Close();
Da Intern
|
|
|
|
|
Hi. I have a desire to create a new front end for our Web access for Exchange 2000. I plan on using a flash frontend, and a web service to do this. However, I hit a slight problem. Its easy enough to find out how to send an email by smtp through exchange, but receiving one? It appears as if this is so complex that no one bothers. There are lots of companies that are trying to sell controls that just send the email, not actually receive it - which seems a bit odd to me.
Anyway, the short of this is, if you know anything at all about what is involved in receiving an Exchange email, please let me know. I have tried finding anything useful, but so far I know how to send an email.
|
|
|
|
|
Sending an email is by far much easier than receiving one. When you send, you use the oldest protocol usually. Receiving requires support for a lot of different things, including authentication, group resolution on the server and much more.
Why are you trying to change the Exchange server like this? There are much easier ways. Exchange is meant to handle incoming email (and outgoing, but CDO on a lot of systems usually works fine for this). You can add extensions to Exchange to make it work different and route messages in many different ways. It's been tested for many years and continues to evolve. You wanna change all that with untested code? I would hope you have a damn good reason.
Even handling SPAM on the server can be done with extensions. I just saw an article about Exchange plug-ins here on CP the other day. Changing the front-end is not the right way. There are many layers of abstraction that can be overridden.
If you want to know how to receive mail, see RFC 821. There's no one answer to this. As I stated before, you have to support as much as possible to be complete and accept mail from many different types of servers and clients, and should also support ESMTP for enhanced and secure transfers, which is becoming increasingly popular these days, especially with SPAM running rampant.
Still feel like changing all this that Exchange already has in it? Make sure you read RFC 821 and the MANY, MANY RFCs that extend it before answering.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi. Thanks for the reply. At first look, I was going to tell you that you did not understand what I meant. Then I realised what exactly you were saying. That got me looking a bit further than I had. I found that for my webmail, I dont need to use SMTP, as IMAP4 will serve the same purpose perfectly. So thanks for getting me to look a bit further.
|
|
|
|
|
I'm not sure you see the distinction here, but I'm glad I could "prompt" you to look further. SMTP stands for the Simple Mail Transfer protocol (no offense if you already knew that). It's simply for transfering mail from one server to another, or from client to server. All your protocols like POP3, IMAPv4, HTTPMail, and any number of proprietary protocols (like Exchange) are what clients use to access mail.
Looking back at your first post, I see what you meant but since you mentioned something to the effect of writing your own SMTP service, I could only infer that you want to replace the front-end for mail transfer. Sorry about that.
As far as different client front-ends, there are a number of articles here on CP and in many other places. POP3 clients are common (because they're easier) but there's some IMAP examples out there that may be of help. Good luck!
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Well, now that the 2.0 specs are out (a few days ago) and I'm sure we all read them ( right? ), I'm curious how they'll introduce the base class libraries with generic support. I mean, it's pretty obvious the BCL was written in C# so while IL apparently supports generics, C# didn't and so the BCL didn't include generics...right?
So, upon the introduction of generics, how will this affect VB.NET and other languages targeting the CLR? Will inference be relied upon for forward compatibility with apps compiled against older libraries running against the new ones, or will they simply just be cut-off? Frankly, I'm a little leary of simply relying on inference for forward compatibility.
In any case, and perhaps someone can correct me, I'm curious why they didn't extend generics to allow interfaces to force certain constructors. Perhaps this okay, though. ISerializable wants a ctor that takes two params (everyone should know what they are) but it doesn't have to be public, limiting access by compilers ( and coders that rely only such compilers and...dare I say it...IntelliSense! ).
So, what's everyone else's thoughts? If you're a n00b, I highly suggest you at least read the C# specifications at http://msdn.microsoft.com/vcsharp/team/language/default.aspx[^].
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Heath Stewart wrote:
Well, now that the 2.0 specs are out (a few days ago) and I'm sure we all read them ( right? ), I'm curious how they'll introduce the base class libraries with generic support. I mean, it's pretty obvious the BCL was written in C# so while IL apparently supports generics, C# didn't and so the BCL didn't include generics...right?
System.Collections.Generic
Heath Stewart wrote:
In any case, and perhaps someone can correct me, I'm curious why they didn't extend generics to allow interfaces to force certain constructors
They did to a small extent with the new() specification. But it would have been nice to be able to say new(typeof(Int32)) and such.
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|
|
Where did you see the namespace reference? Did I pass over it in the specs (though I wouldn't expect to find it there). I've been reading several things about it on MSDN (and now the specs) and have seen much about what to expect (other than the language changes).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
|
|
Heath Stewart wrote:
So, upon the introduction of generics, how will this affect VB.NET and other languages targeting the CLR?
VB .NET is also slated to include generics. I don't know how the introduction of generics will affect other languages, such as Eiffel .NET, that already implement generics on .NET 1.x. Presumably they will have to rework their implementation to be compatible?
Kevin
|
|
|
|
|
hii all...
i'm working on an application that preview the current processes on the machine and the state of the process (responding or not responding) and the memory used by the process (something like task manager)
i'm using a listbox to preview the processes
so i have some questions...
1- how can i allow columns??...(one column for the process name and one for the memory used and one for the state and so on)all the information about each process is in the same row the row is divided into columns..
2-i wanna the listbox to disply the changes in the memory used eah 1 sec how can i do it (i tried to redraw the listbox each second but i found it sucks)
3-i used the following code to display the process name and its state :
private static Process[] processes=Process.GetProcesses();
for(int x=0;x
|
|
|
|
|
You really should read the class documentation. ListView subitems are definitely explained clearly enough.
bora3ee wrote:
1- how can i allow columns??...(one column for the process name and one for the memory used and one for the state and so on)all the information about each process is in the same row the row is divided into columns..
Set ListView.View to View.Details . Add columns using the ListView.Columns properties.
bora3ee wrote:
2-i wanna the listbox to disply the changes in the memory used eah 1 sec how can i do it (i tried to redraw the listbox each second but i found it sucks)
You either have to derive from ListView and handle the OCM_NOTIFY messages to have the NM_CUSTOMDRAW notifications, or handle the WM_NOTIFY in the parent of the ListView , handling the specific (and many) NM_CUSTOMDRAW notifications. This requires P/Invoking several Win32 functions from the Platform SDK and redefining a lot of message IDs and structures. This isn't for newbies, but there are lots of tutorials here on CP (which you should always check for first, since that's the whole point of this site).
You can then control which items and subitems are redrawn and when.
bora3ee wrote:
3-i used the following code to display the process name and its state :
private static Process[] processes=Process.GetProcesses();
for(int x=0;xlistBox1.Items.Add(processes[x].ProcessName.ToUpper().ToString()+"\t\t\t"+(processes[x].Responding ?"Running" :"NotResponding"));
??? There's no different in your output. Check your HTML formatting.
bora3ee wrote:
4- how can i display only current applications not processes???
Applications == processes. Please elaborate. If you want to see current Windows applications / processes, you enumerate the processes and check the Process.MainWindowHandle . If it's IntPtr.Zero , it doesn't have a GUI associated with it (no main Window handle). If the return isn't IntPtr.Zero , it's a Windows application.
In the future, it would also be easy to get help if you post these questions as separate posts. You're more likely to get help with at least some of them and it's easier for potential helpers to follow along and reply when necessary.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi
I have VS 2003. However, I do not appear to have the System.Web.Mail namespace. Does anyone know how to get this, or where to download it from? It appears it should be there, as I cant find a download for it on Microsoft.com, yet a lot of their examples use it.
Thank you
|
|
|
|
|
By saying that a "namespace is missing", you're implying that you don't have the right assemblies referenced. In a project, you can't just include namespaces in your source files and call it good. The project has to reference the right assemblies that contain those namespaces. So, in your VS.NET project, right-click and select Add Reference. Find the System.Web assembly and add it as an assembly reference.
This is no different than any other API / framework. In C++ you have to bind to a static lib or DLL to call a function in there. In PERL, you have to use the right mod, and in VB - right TLB.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi All,
Could anybody point me in the right direction of how to create a class library using C#.NET 2002 standard edition? As it does not have a project template for creating a class library I am finding it difficult to find the right incantation. Any help would be appreciated? (I am assuming this is actually possible.... )
Cheers,
Ewan.
|
|
|
|
|
Step 1) Run notepad.
Step 2) Type: class MyLibrary { public void Foo() {} }
Step 3) Save file as "MyLibrary.cs"
Step 4) Compile with: csc /t:library MyLibrary.cs
Presto, you have a class library in MyLibrary.dll, add it as a reference, call it from anywhere, all that good stuff.
(I'm sure someone else will come along and tell you which buttons to push and checkboxes to change.)
-Blake
|
|
|
|
|
Thanks,
Not really answering the question I asked tho: How do I create it in VS.NET 2002. Not notepad? I.e. where is the setting where I tell the IDE that I want the command line compile option /t:library
Thanks,
Ewan.
|
|
|
|
|
ewan wrote:
Not really answering the question I asked tho
I know. I'm one of those crotchety old farts who thinks relying on templates and wizards and such weakens the mind.
The "VS.NET IDE issues" forum is five lines down. I don't tease people there.
-Blake
|
|
|
|
|
Hehehe
No problem. Can't say I blame you Am very new to .NET environment having done lots in VC++ 6. Can't say the transition is going well
Ta
Ewan.
|
|
|
|
|
While I'm with Blake on this one, I will tell you that C# projects actually come in two varieties: ASP.NET and not. For the "not", you can easily change the target type by right-clicking on the project and selecting "Class Library".
Don't forget to the read the documentation and explore a little, otherwise you'll never amount to anything more than a code monkey. Would you spends thousands of $$$ at a university without cracking a book, or take-off in a brand new jet without reading the product instructions and features? Why do so with a framework or IDE (remember, VS.NET is just a development environment).
And exploration is also important - if people didn't explore all 6 billion of us would be stuck around Iran and Iraq were humanity apparently started and we be as dumb as al Qa...er, rocks!
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I think you are slightly missing the point. Personally when I approach a problem and find a stumbling block I do the following:
1) Read the documentation.
2) If the answer isn't forthcoming (as it really isn't in this case) (oh and your answer is plain wrong btw for the standard edition) ask someone who likely has far more knowledge than I will every have on the subject.
Result.... almost immediate answer (plus obligatory flaming).
I've coded in c++ for many years and while I am certainly a code monkey at heart I would like to think I do amount to something . Just because I'm trying to expand my knowledge in the form of c# shouldn't mean I have to read the entire MSDN before I'm entitled to ask questions.
Ewan.
|
|
|
|
|
Sorry, "right-click on the project, select properties, and select "Class Library". Should be obvious since it's consistent with everything else in Windows, and I was able to find it in the MSDN Library in under a minute by following a natural chain of topics, like ".NET Development"/"Visual Studio .NET"/"Product Documentation"/ etc.
Besides, "coding" does not make a developer. Good research skills are important. And while forums like this are here to help, even exploration of the UI at the very least should've uncovered this. You're right, sometimes the documentation isn't so obvious, but by exploring you certainly learn a lot more. And while some will read the MSDN Library thoroughly, at least exploring the topics covered is better than not - especially the .NET Class Library reference.
So, do you get my point?
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|