|
public ServiceResponse(HttpWebResponse resp) : base(resp)
{ //how do I set the base WebResponse to resp? }
this forces a base constructor that takes this parameter to be called.
I'd be surprised if you need this code, I'd expect the base constructor to work, as in
ServiceResponse sr = new ServiceResponse(resp); // I think this should call the base constructor for you but build the derived object )
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
You can't do that. When the constructor is running, the object is already created, and you are in it.
When you create an instance of an inherited class, there is just that instance. There is no separate base object.
Perhaps you want to encapsulate an instance of the WebResponse class in your class, instead of inheriting from it.
---
single minded; short sighted; long gone;
|
|
|
|
|
Guffa wrote: Perhaps you want to encapsulate an instance of the WebResponse class in your class, instead of inheriting from it.
Yeah, I just did this and it seems like a better fit.
/\ |_ E X E GG
|
|
|
|
|
Are you looking for something like this?
public class ServiceResponse : WebResponse
{
public ServiceResponse
(
HttpWebResponse resp
)
: base ( resp )
{
}
}
|
|
|
|
|
Pretty self explanatory. How do you call from a different class? Thanks in advance -M.S.
MasterSharp (not REALLY an master...)
|
|
|
|
|
If it's a static method, just specify the class name. Example:
Color bg = Color.FromArgb(255, 255, 255);
If it's not a static method, you need an instance of the class to call it. Example:
float hue = bg.GetHue();
(I have used the Color class as an example because it's a well known existing class. The principle is the same for calling methods in any class.)
---
single minded; short sighted; long gone;
|
|
|
|
|
|
Or, better yet, use delegates.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
MasterSharp wrote: Pretty self explanatory. How do you call from a different class?
No, your question is anything but "self explanatory". You're going to have to provide more details about the problem, 'cause right now, I can see about 4 different situations that would fit your description, none of them the same.
What are the classes?? Which one instantiates the other?? Are you talking about a callback or event?? Are you trying to pass data from one form to another?? ...?? ...??
|
|
|
|
|
Call another (whatever this is called) public void (whatever right here) Is that a method, or statement? And I meant self explanatory about the subject, not on difficulty.
|
|
|
|
|
MasterSharp wrote: And I meant self explanatory about the subject, not on difficulty.
So did I. You (still) haven't covered the subject with enough detail to do anything with other than guess at what you want to do.
You declare an instance of a class, which is then known as an Object of type SomeClass , then you call methods of that object.
SomeClass myInstance = new SomeClass();
myInstance.SomeMethod();
int result = myInstance.SomeOtherMethod(someParameter);
|
|
|
|
|
|
I would like to know how to draw a square/rectangle, not filled, and have it move with the arrow keys. I have looked around and everything is just odd, and unworking. If anyone doesn't know how to draw it, that's fine, but I would really apprectiate the movement with arrows. Thanks in advance, M.S.
MasterSharp (not REALLY a master...)
|
|
|
|
|
If a rectangle is a target object, then create a Label control with no text and BorderStyle set to Single. Then handle KeyDown event of the parent Form.
If you are going to expand graphics, then use GDI (Graphics.DrawRectangle(...); ), however in such case you will have to invalidate a form in this rectangle (this.Invalidate(rect); ) (Another way a rectangle would leave it's trace after a movement).
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
Hi,
there are four steps to draw something so it becomes visible on the screen:
1.
decide on what object you want to draw; it normally is a Control (e.g. a Panel) or a
Form itself. I prefer to add a Panel to a Form, then draw on the Panel.
2.
create some variables (Rectangle, struct, class, whatever) that hold the parameters of
your drawing. In your case that could be top and left coordinate, and width+height,
or just a Rectangle.
3.
create a Paint handler for that Panel, and do all your drawing in there, using the
Graphics class and your variables.
4.
when you want to animate things, modify the variables and call Panel.Invalidate() or
one of its overloads (for selective invalidation).
BTW: if you need to create some objects (Fonts, Pens, Brushes, ...) either keep them
alive in class members (hence create them only once); or create them inside the Paint
handler and don't forget to call Dispose() on them.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I get this error using this code :
string strSQL = "";
if (klantID > 0)
{
strSQL = "INSERT...";
}
else
{
strSQL = "UPDATE...";
}
The error is on the line where the update-query is assigned to strSQL.
What's the reason I get this error ?
|
|
|
|
|
I don't see how that code can produce that error. Is this the actual code you are using?
|
|
|
|
|
This is the actual code (except for not mentionning the whole query because otherwise it would be too long).
|
|
|
|
|
Landie110 wrote: This is the actual code (except for not mentionning the whole query because otherwise it would be too long).
How do you build the query?
|
|
|
|
|
this is the full code:
if (klantID > 0)
{
strSQL = "INSERT INTO [IBAX].[dbo].[klanten] ([klantOndNr],[klantNaam],[klantStraat]" +
",[klantPostcode],[klantGemeente],[klantLand],[klantContact],[klantTelefoon]" +
",[klantGSM],[klantFax],[klantEmail],[klantURL],[klantTaal]) VALUES (";
strSQL = strSQL + "'" + klantOndNr + "', '"
+ klantNaam + "', '"
+ klantStraat + "', '"
+ klantPostcode + "', '"
+ klantGemeente + "', '"
+ klantLand + "', '"
+ klantContact + "', '"
+ klantTelefoon + "', '"
+ klantGSM + "', '"
+ klantFax + "', '"
+ klantEmail + "', '"
+ klantURL + "', "
+ klantTaal + ")";
}
else
{
strSQL = "UPDATE [IBAX].[dbo].[klanten] SET [klantOndNr] = '" + klantOndNr
+ "', [klantNaam] = '" + klantNaam
+ "', [klantStraat] = '" + klantStraat
+ "', [klantPostcode] = '" = klantPostcode
+ "', [klantGemeente] = '" + klantGemeente
+ "', [klantLand] = '" + klantLand
+ "', [klantContact] = '" + klantContact
+ "', [klantTelefoon] = '" + klantTelefoon
+ "', [klantGSM] = '" + klantGSM
+ "', [klantFax] = '" + klantFax
+ "', [klantEmail] = '" + klantEmail
+ "', [klantURL] = '" + klantURL
+ "', [klantTaal] = " + klantTaal
+ " WHERE klantid = " + klantID;
}
|
|
|
|
|
It must be something specificly with the update-instruction.
I've tried it using only the update (so no if...else, always use update) and I've got the same error message.
I've replaced the update with the exact same code for if (the insert-instruction) and then I don't get the error.
I've tried changing the building of the update instruction a little bit but I still get the same error.
|
|
|
|
|
Landie110 wrote: + "', [klantPostcode] = '" = klantPostcode
You have put an assignment operator (=) where the concatenation operator (+) should be.
-- modified at 16:51 Saturday 29th September, 2007
(Incidentally, the swedish word "klant" describes a person that has messed up. )
---
single minded; short sighted; long gone;
|
|
|
|
|
Well, spotted. I just went on a tangent about SQL Injection Attacks. (Well, what else am I going to talk about).
Just as well I asked to see the whole code.
|
|
|
|
|
Colin Angus Mackay wrote: I just went on a tangent about SQL Injection Attacks. (Well, what else am I going to talk about).
ROTFL !!!
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Guffa wrote: (Incidentally, the swedish word "klant" describes a person that has messed up. )
Just as well Landie110 is from Belgium where it means "client".
|
|
|
|
|