|
Are you talking about the SMTP headers for the email? You don't discard it - you use it. That contains the To:, From:, Subject:, and Content-Type: headers, along with other headers that may or may not be useful to you. This is partly how email travels throughout the 'net (though the TO and most often the FROM - except for those mail servers that don't authenticate the sender, commonly used by spammers! - are also handled by the SMTP protocol regardless of the headers).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Does a control exist where I can load it with any number of images (one on top of the other) and then vertically scroll through them for viewing?
My images will all be the same width but not the same height.
I was thinking to host a webpage in my app and have local tags for the images but I don’t want the overhead. Any other ideas you would be great to have.
Thanks!
|
|
|
|
|
This would be a simple owner-drawn ListBox , for which several articles on this site already cover what you need to do (or alternatives, at least). Read ImageListBox - exposing localizable custom object collection as a property[^]. If covers a few things you didn't mention requiring, but the source will give you an idea.
Basically, you just set DrawMode to DrawMode.OwnerDrawVariable (since they could be different heights, as you mentioned), and handle both the MeasureItem and DrawItem events.
If you would actually be better, however, to extend ListBox with your own implementation (perhaps something like ImageListBox ) that overrides the DrawMode property (always returns DrawMode.OwnerDrawVariable but does nothing or throws a NotSupportedException or something in the set accessor) and the OnMeasureItem and OnDrawItem methods (don't forget to call the base class's implementation so that events are fired). This is a far better approach because you won't have to implement all this code again every time you want to have an ImageListBox -like control, and overriding methods is faster than handling events. It's all about encapsulation.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi guys,
below is a code snippet that is raising a cast exception when I attempt to pull out data from a row reader.
// setup
command = "SELECT IDENT_CURRENT ( @tableName )";
getLastIdentityCommand = new SqlCommand(command);
getLastIdentityCommand.Parameters.Add("@tableName", SqlDbType.VarChar, 20);
....
// in my prepare ftn routine , I set the connection and table name
getLastIdentityCommand.Connection = con;
getLastIdentityCommand.Parameters[0].Value = tableName;
getLastIdentityCommand.Prepare();
...
// finally I use the damn thing elsewhere
SqlDataReader rowReader = getLastIdentityCommand.ExecuteReader();
long lastInsertId = -1; // I was using 'int' before but problem still remains
if (rowReader.Read())
lastInsertId = rowReader.GetInt64(0); // causes cast exception
...
Things to NOTE:
1) A row is inserted into a table X with identity set - identity column is of type bigint, before the problematic db command is issued
2) I have even tried using the "SELECT @@identity" syntax in the select statement without a table name, and tried extracting the id generated as follows :
int lastInsertId = (int)getLastIdentityCommand.ExecuteScalar();
3) I have even tried rowReader.GetInt32(0); and still the same exception.
Is an identity a special type and NOT and integer?? How can I get this value
since I need to update a 2nd table with it.
ANy and all help will be very appreciated.
Thanks.
|
|
|
|
|
Never mind guys, I got it - the bigint is of type decimal, I'm going to stick to int as it falls under my requirement range anyway. Don't know why I chose a damn bigint in the first place.
Thanks for reading.
|
|
|
|
|
Hi,
Has anyone developed a custom metadata editor using C#.net or vb.net. if yes, i have a question.
I am trying to develop a custom metadata editor using C#.net. i am using ArcGis 8.3 and Visual studio .net 2003.
when i am trying to execute my custom metadata editor in ArcCatalog it says "Object reference not set to an instance of an object". i don't know where i am going wrong..
I appreciate your help in this regard..
example is given on http://arcobjectsonline.esri.com
Thanks,
Abhi
abhi
|
|
|
|
|
This may be useful - I got this error once for a completely different project (nothing related to yours) and it turned out that some of the dll's I had added a reference to had recently changed and I had an older copy.
Say the new X.dll had a ftn call Y() and my lod X.dll did not contain the ftn Y(). Funny thing is the code compiled fine but at runtime it caused the exception you are getting. When I refreshed the dll, it worked fine.
Hope this helps.
|
|
|
|
|
Actually, that would throw a TypeLoadException since the types are not the same, but you apparently handled the exception and continued executing code, meaning that the object you were trying to instantiate of that type was still null , hence the NullReferenceException .
You can avoid this problem in your multi-project solution by adding project reference instead of assembly reference. So, if project "B" depends on project "A", right-click on project "B", select Add Reference, then click the Projects tab. Double-click project "A" to add it.
Now a build dependency is established. Any changes to project "A" will cause project "A" to be compiled when you compiled project "B", and if project "A" is recompile project "B" will grab the new copy when it's compiled. This also means that when you compile a release build of project "B", a release build is compiled for project "A", thus keeping your builds in sync as well.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
Has anyone developed a custom metadata editor using C#.net or vb.net. if yes, i have a question.
I am trying to develop a custom metadata editor using C#.net. i am using ArcGis 8.3 and Visual studio .net 2003.
when i am trying to execute my custom metadata editor in ArcCatalog it says "Object reference not set to an instance of an object". i don't know where i am going wrong..
I appreciate your help in this regard..
example is given on http://arcobjectsonline.esri.com
Thanks,
Abhi
|
|
|
|
|
If you have a question about a specific product, you should ask on their site (forums, contact emails, etc.). This is not specific to C#, nor should it be expected of this community to support a commercial or non-commercial product; we probably have never even used it.
This is what company/organization support sites are for.
Based on the exception, though, all I can tell you is that your not setting an instance to something, which should be evident from the error.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
Has anyone developed a custom metadata editor using C#.net or vb.net. if yes, i have a question.
I am trying to develop a custom metadata editor using C#.net. i am using ArcGis 8.3 and Visual studio .net 2003.
when i am trying to execute my custom metadata editor in ArcCatalog it says "Object reference not set to an instance of an object". i don't where i am going wrong..
I appreciate your help in this regard..
Thanks,
Abhi
|
|
|
|
|
I would like to convert this string:
1075912849
into this format
02/04/04 08:40:49
|
|
|
|
|
Gee, thanks for all the information and for asking nicely!
What is that number? If it's the number of milliseconds or ticks, from what epoch does it start? Whether it's UTC or not has no bearing, so long as you treat it as UTC.
If you read the documentation for the DateTime struct in the .NET Framework SDK, you'll see that the DateTime struct has an epoch of 1/1/0001 00:00:00. Without knowing the epoch of that number, it's impossible to help you, other than tell you to read about the well-documented DateTime and it's members, such as Parse and it's constructor, which takes a number as a long which represents the ticks (100 ns) since the epoch I mentioned.
If you need help, please provide more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
how can i get my datagrid to reset itself so as the mouseup events keeps firing in my cell? i appreciate the mouse up event is on my datagrid but i would like it to fire every time?
|
|
|
|
|
Declare a state variable and set/reset it when you need. Use a timer if you have to.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Looking for a Cotrol, wich implements the TextFolding just like the Visual C#-Editor
THX
|
|
|
|
|
There is a open source project--"SharpDevelop", it may be helpful to you.
|
|
|
|
|
Hello people, I have an Web Application and I need to get the Mac Address from client computer for security reasons. So I tried to do this by using Windows Control, but Windows Control isn't working when I call for System.Management objects like when I try to get the Mac Address. Explorer shows an alert about SecurityException. Anyone knows how to do this? another solution?
tks
Wender Oliveira
.NET Developer
|
|
|
|
|
You're trying to get the MAC address of a client on the server side of your ASP.NET application. The short answer is, you can't. Not because of the security restrictions either. Simply because when you try and do an ARP resolve on the IP address, you'll get the MAC address of the NIC on the side of the router that the server is on, not the client machine. There is no method of getting the MAC address of a NIC unless that NIC happens to be on the same physical subnet as the server.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
Im creating a basic port scanning program that using multi threads to scan ports to serve as a way for me to learn Sockets and Threadpooling, but when i build the program and try to scan one port i get an exception error.
System.Net.Sockets.SocketException: The requested name is valid and was found in the database, but it does not have the correct associated data being resolved for
at System.Net.Dns.GetHostByName(String hostName)
at System.Net.Dns.Resolve(String hostName)
at System.Net.Sockets.TcpClient.Connect(String hostname, Int32 port)
at PortScanner.frmportscanner.scanport(String host, Int32 port) in d:\csharp\ircbot\windowsapplication1\port scanner.cs:line 258
Any Suggestions?
|
|
|
|
|
Try using nslookup.exe in the command-prompt for the name you're trying to connect to and see what you get. The exception message indicates that the necessary data (perhaps an IPv4 address?) wasn't found.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I get that exception for every address i type in.
|
|
|
|
|
I have written a service that grabs the files in a source directory on a remote server and ftp's to local directory. The service monitors the source directory of the server and collects the files as they come in. The Problem: Sometimes the files are physically present but the service recognizes and at the time of transfer it cannot get handle on them. I gut feeling is - the service tries to grab the file when it is in the process of being tranferred to the source directory. It loses the handle on the file and can never recover thereafter. Any suggestions !
Thanks / Vinayak
|
|
|
|
|
The service should maintain a list of files it has tried to copy. If the copy is successful the file can be removed from the list, if not an attempt can be made on the next cycle when it looks for files again.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
My Blog
|
|
|
|
|
Thanks Colin.
I have an ftp component that returns the list of files in the source directory as a dataset. But once the file is failed to be tranferred via the Service Component - I go for the next one tranfer it.
When the service makes the next attempt - is gets the failed file
in the list but fails to transfer saying that "the file can not be found".
|
|
|
|