|
I have successfully logined into a web page, the background management in this page contains multiple pages and per page has its own corresponding URL, I want the information of one page collected in the process. When I get the page URL, but it's the source of information and data display,and when I use HTML tags to preview display only a page frame, information are not displayed, but in the browser open the URL can display properly. How do I get this page?
|
|
|
|
|
I don't really understand what you want, or what your problem is. If I do understand you correctly, you want to get the source of a certain url. You can perform a webrequest
WebRequest wrFetch = WebRequest.Create("http://www.google.com");
The webrequest contains a response object which will contain the source of the webpage called.
|
|
|
|
|
Hi,
Maybe I was not expressing a very clear, but thank you for your support, you give a good idea!
|
|
|
|
|
Does anyone know how to go about adding your own .Empty property as in String.Empty?
N.B. I should mention its currently a struct!
Definitely a PEBCAK! (Problem Exists Between Keyboard And Chair)<br><a href="http://www.fruitbatinshades.com" target="_blank">www.FruitBatInShades.com</a></br>
|
|
|
|
|
Make it static?
public static MyClass Empty { get { return new MyClass(); } }
|
|
|
|
|
Hi, Tried that but get
Operator '!=' cannot be applied to operands of type 'RNMCore.DateRange' and 'RNMCore.DateRange'
Any Ideas?
Definitely a PEBCAK! (Problem Exists Between Keyboard And Chair) www.FruitBatInShades.com
Doh! figured it out, many thanks
public static bool operator ==(DateRange left, DateRange right)
{
return (left.StartDate == right.StartDate) && (left.EndDate == right.EndDate);
}
public static bool operator !=(DateRange left, DateRange right)
{
return (left.StartDate != right.StartDate) && (left.EndDate != right.EndDate);
}
|
|
|
|
|
Well, that's a separate problem... .NET doesn't automatically know how to determine whether two structs are equivalent.
You need to overload the equality operator. Should be easy to find resources on that, but here's[^] a decent enough starting point.
|
|
|
|
|
Why not simply...
public static bool operator !=(DateRange left, DateRange right)
{
return !(left == right);
} ?
|
|
|
|
|
public static bool operator !=(DateRange left, DateRange right)
{
return (left.StartDate != right.StartDate) || (left.EndDate != right.EndDate);
}
|
|
|
|
|
string.Empty is a static getter property. You can add such static getter to any class you create, and have it return whatever you want. Like so:
public class MySillyExample {
public static string Empty {
get {
return "this is not an empty string";
}
}
}
It is unrelated to a current object ("this"), and quite different from a non-static Clear() method.
|
|
|
|
|
Empty is normally a static readonly field such as...
public struct YourStruct
{
public static readonly YourStruct Empty = new YourStruct();
}
|
|
|
|
|
However, can a struct really be empty? it has a fixed size after all, unlike a string or a list.
OTOH, .NET does offer a Size.Empty and a Point.Empty; if I had a say, I'd call it Zero, not Empty.
|
|
|
|
|
Luc Pattyn wrote: can a struct really be empty? it has a fixed size after all
Very true.
Luc Pattyn wrote: I'd call it Zero
I think MS reserve that for single value structs such as IntPtr which uses Zero .
|
|
|
|
|
I'm trying to learn c# from knowing a much more idiot proof programming language (autoit) and I'm completely lost. I thought I'd start out with a simple windows form project of a ping utility that someone else had written and then modify it from there and be able to learn where I have a working example and can alter the code in different places and visually see what changes.
I cannot find a working example, just about everything I've found on the web will not compile, which probably means that I am doing something wrong, but unfortunately I'm not sure what it is, so I need this first example spoon fed to me. If I can compile and revert back if I break something, I'll be able to learn quickly that way.
Sadly enough, I'm not even able to get the msdn to work
http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping.aspx[^]
Any help in helping me build a decent foundation of understanding the syntax of this would be greatly appreciated.
|
|
|
|
|
You did find the right web site, now you need to learn and use the search facilities.
Please look here[^].
|
|
|
|
|
Hi,
I found Wesley Browns through the search and that didn't compile and that's when I decided to seek help through the forum as I figured I was doing something fundamentally wrong.
I will parse through the other search results if you think I will have success with another result.
Thanks for the reply.
|
|
|
|
|
Three comments:
1.
don't say "it does not work" or "it does not compile", be specific. Tell us what tools you are using, and what the first (and second) error messages are saying.
2.
Look at the line numbers; they are there to help you out. If you want to be a programmer, you must learn to help yourself. Asking in a forum like this one is fine as a second option, not really as a first.
3.
Each CP article has its own forum where you can find other people's comments on the article, could be quite interesting; and where you can add yours. Adding a "New message" will signal the article's author, so you might get HIS response to your troubles, something you are not likely to get here.
|
|
|
|
|
Ok
I am using c# 2008 express. I'll use Wesley Browns code as an example. I try and open the pingtest.sln file and 2008 express tells me I have to convert it. I back up the original and convert. On the right hand side of 2008EE I see 2 projects
I press start without debugging and I get "A project with an Output Type of Class Library cannot be started directly .... "
This is a different error then what I have seen with other projects I have found on the web, but it stops me from going further none the less.
C# Ping Component[^]
|
|
|
|
|
You said there are two projects. I suspect, though I haven't looked at the article you're talking about, that one project is a class library and the other is a Windows Forms exectuable. Right click the other project and pick "Set as Startup". Then try and launch it.
|
|
|
|
|
you can build each project separately, or the entire solution at once.
however you can not run a DLL, the only thing you can run is a project that leads up to an EXE file. So make the right project the "startup project" (right-click in solution pane), and there you go.
this your problem is not related to programming, it is you not being familiar with Visual Studio. That takes some time.
|
|
|
|
|
David, Luc
You were both correct, thank you! I'm going to start watching tutorial videos on c# and 2008 express in a minute based on your observations.
You are right, I am having trouble with Visual Studio ... now that I can compile one of the projects, I can't even find where the code is that goes into this project
|
|
|
|
|
You're welcome.
Enjoy your Visual adventures!
|
|
|
|
|
How to create a master page in C# ?................
|
|
|
|
|
You don't create it in C# - you create it in Visual Studio by selecting the appropriate project type in the "New Solution" dialog box.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Not a project type ,
Right Click on your Website not "Solution Explorer" and Select "New Item" and a Dialog box will appear and select master page. For more info on that look at this
http://www.devx.com/dotnet/Article/18042[^]
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|