| View previous topic :: View next topic |
| Author |
Message |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
Posted: Fri May 22, 2009 5:29 am Post subject: property remains null after it gets assigned a value. |
|
|
Ok so I'm really confused. Why is this happening to me? The picture kind of explains the issue. If not then I send a string as a argument into a method and assigns the flashvars parameter of the flash control. Then it reaches the breakpoint and still flashvars is empty. why, WHY?!
| Description: |
|
| Filesize: |
77.08 KB |
| Viewed: |
9108 Time(s) |

|
_________________
Intel over amd yes. |
|
| Back to top |
|
 |
92Garfield I'm a spammer
Reputation: 57
Joined: 20 Dec 2007 Posts: 5871 Location: Banana Republic Germany
|
Posted: Fri May 22, 2009 8:10 am Post subject: |
|
|
this is c#?
maybe you shouldnt name them the same as the propereity
_________________
|
|
| Back to top |
|
 |
Odecey Master Cheater
Reputation: 1
Joined: 19 Apr 2007 Posts: 259 Location: Scandinavia
|
Posted: Fri May 22, 2009 11:52 am Post subject: Re: property remains null after it gets assigned a value. |
|
|
| Beloved Hero wrote: | | Ok so I'm really confused. Why is this happening to me? The picture kind of explains the issue. If not then I send a string as a argument into a method and assigns the flashvars parameter of the flash control. Then it reaches the breakpoint and still flashvars is empty. why, WHY?! |
This isnt really enough information to conclude what the problem is. Are you sure that the variable that is used as FlashVars parameter in the call is not empty? I'd also like to add a small suggestion to use the naming convention to use a small letter for the first word, followed by a capital sized letter in each subsequent word in the variable name.
_________________
Never confuse activity with productivity. You can be busy without a purpose, but what's the point?- Rick Warren |
|
| Back to top |
|
 |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
Posted: Sun May 24, 2009 12:22 pm Post subject: |
|
|
Ok.
To the previous poster. Did you take a look at the picture above? It tells you the value of the string.
So the string I send to the flash control is not null.
Plus it doesn't matter if I name the variable the same as the property..
Will someone that know's the thing come please?
_________________
Intel over amd yes. |
|
| Back to top |
|
 |
hehewaffles How do I cheat?
Reputation: 0
Joined: 23 Apr 2009 Posts: 5
|
Posted: Thu May 28, 2009 6:03 pm Post subject: |
|
|
If this is Visual Studio, you could try Cleaning the project and then rebuilding and running it. That very rarely solves it, but it's helped me once before.
The reason it would work is because Visual Studio kept old stuff that you changed, but didn't realize you really changed it, and it kept the old debug files, and linked those into the exe. Cleaning clears out the old folder, and then rebuilding it would completely remake it.
Another possibility is that you're passing an invalid value, and the property setter doesn't like that?
Remember that a property works like this, most of the time:
| Code: |
private string _field;
public string Property
{
get{ return _field; }
set{ _field = value; }
}
|
but can also sometimes work like this:
| Code: |
private string _field;
public string Property
{
get{ return _field.Substring(0,1); }
set
{
if (value == "something stupid")
return;
_field = value.Substring(0,1);
}
}
|
When you compile it, it basically ends up like this:
| Code: |
private string _field;
private string get_field()
{
return _field.Substring(0,1);
}
public void set_field(string value)
{
if (value == "something stupid")
return;
_field = value.Substring(0,1);
}
|
|
|
| Back to top |
|
 |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
Posted: Fri May 29, 2009 3:47 am Post subject: |
|
|
I'm sorry that im such a noob but it is suppoed to be null :/ the property works like a method. It parses the string and add the vars.
_________________
Intel over amd yes. |
|
| Back to top |
|
 |
Scathe I post too much
Reputation: 0
Joined: 02 Aug 2006 Posts: 3631 Location: Smoking a blunt
|
Posted: Fri May 29, 2009 8:33 am Post subject: |
|
|
You're setting flashvars equal to itself.
You need to use different names, even if its flashvars_1 or something.
| Code: | | AxShockwaveFlash.FlashVars |
Here you're accessing member "FlashVars" from class AxShockwaveFlash.
| Code: | | .FlashVars=FlashVars |
Seeing as you didnt post any other code its impossible to tell whether the member FlashVars is public or not, but if it is then you are just setting it = to itself.
If FlashVars is NULL and you set it equal to itself, it will remain NULL.
Try changing your variable names.
_________________
<Moose> they will call me beard penis |
|
| Back to top |
|
 |
hehewaffles How do I cheat?
Reputation: 0
Joined: 23 Apr 2009 Posts: 5
|
Posted: Fri May 29, 2009 9:52 am Post subject: |
|
|
| Scathe wrote: | You're setting flashvars equal to itself.
You need to use different names, even if its flashvars_1 or something.
| Code: | | AxShockwaveFlash.FlashVars |
Here you're accessing member "FlashVars" from class AxShockwaveFlash.
| Code: | | .FlashVars=FlashVars |
Seeing as you didnt post any other code its impossible to tell whether the member FlashVars is public or not, but if it is then you are just setting it = to itself.
If FlashVars is NULL and you set it equal to itself, it will remain NULL.
Try changing your variable names. |
Nope.
The "FlashVars" when used without a class is implied to be currently in scope; either having been declared in the current method, or declared in the current class (which would be the same as this.FlashVars).
By saying AxShockwaveFlash.FlashVars, he's specifying the "FlashVars" within the "AxShockwaveFlash" object, rather than the one currently in scope.
Also, just so you know, a variable declared in scope has higher precedence than one declared in the current class:
| Code: |
class Test
{
public string Hello
{
{ get { return "Hi!"; } } //only an accessor; if one were to try to set
//this property, there would be a compile error
}
public void SetHelloText(ref string Hello)
{
Hello = "Hi!";
}
}
|
That would compile, and work like this:
Say we have an external class:
| Code: |
class Tester
{
private Test _test;
public void Foo()
{
string Bar;
_test = new Test();
_test.SetHelloText(ref Bar);
}
}
|
Bar gets the text "Hi!"
We could have just as easily made Bar get something completely different, though, like "C# is cool" or "High school sucks," etc.
Edit:
Also, just FYI, he already found the answer, haha.
|
|
| Back to top |
|
 |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
Posted: Fri May 29, 2009 10:01 am Post subject: |
|
|
hehewaffles is correct at both points.
_________________
Intel over amd yes. |
|
| Back to top |
|
 |
Scathe I post too much
Reputation: 0
Joined: 02 Aug 2006 Posts: 3631 Location: Smoking a blunt
|
Posted: Fri May 29, 2009 11:35 am Post subject: |
|
|
Well..i tried.
_________________
<Moose> they will call me beard penis |
|
| Back to top |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Fri May 29, 2009 1:14 pm Post subject: |
|
|
Check the return value. That's what you do ALWAYS, ppl tend to forget error checking nowdays.
Probably incompatible types or something and hence it's return value marks false -> RTFM(?) or should I say docs for property and your Flash class.
EDIT: Eh, reading earlier posts (hehewaffles), I notice my point is already mentioned :(
|
|
| Back to top |
|
 |
|