Questions tagged [setvalue]

setvalue is an ambiguous tag askers use to indicate they have a problem assigning a value to "something".

setvalue is an ambiguous tag askers use to indicate they have a problem assigning a value to "something". This tag should - if possible - generally be avoided. Proper use of the setvalue tag is if the question specifically targets a certain setvalue function.

365 questions
358
votes
12 answers

Setting a property by reflection with a string value

I'd like to set a property of an object through Reflection, with a value of type string. So, for instance, suppose I have a Ship class, with a property of Latitude, which is a double. Here's what I'd like to do: Ship ship = new Ship(); string value…
David Hodgson
  • 10,104
  • 17
  • 56
  • 77
59
votes
3 answers

What's the difference between Dependency Property SetValue() & SetCurrentValue()

The reason why I am asking this is because I was recommended by @Greg D (from this question) to use SetCurrentValue() instead, but a look at the docs and didn't see whats the difference. Or whats does "without changing its value source"…
Jiew Meng
  • 84,767
  • 185
  • 495
  • 805
35
votes
2 answers

Angular 2 - FormControl setValue 'onlySelf' parameter

Trying to understand what the 'onlySelf' parameter does when passing to setValue. this.form.get('name').setValue('', { onlySelf: true }) The documentation says: "If onlySelf is true, this change will only affect the validation of this FormControl…
leepowell
  • 3,838
  • 8
  • 27
  • 35
32
votes
8 answers

Is there a way to create a delegate to get and set values for a FieldInfo?

For properties there are GetGetMethod and GetSetMethod so that I can do: Getter = (Func)Delegate.CreateDelegate(typeof(Func), propertyInfo.GetGetMethod()); and Setter = (Action
nawfal
  • 70,104
  • 56
  • 326
  • 368
29
votes
3 answers

Reflection Performance - Create Delegate (Properties C#)

I'm having performance problems with using reflection. So I decided to create delegates for the properties of my objects and so far got this: TestClass cwp = new TestClass(); var propertyInt = typeof(TestClass).GetProperties().Single(obj => obj.Name…
J. Lennon
  • 3,311
  • 4
  • 33
  • 64
22
votes
3 answers

Using reflection to set object properties without using setValue forKey

In Swift it's not possible use .setValue(..., forKey: ...) nullable type fields like Int? properties that have an enum as it's type an Array of nullable objects like [MyObject?] There is one workaround for this and that is by overriding the…
Edwin Vermeer
  • 13,017
  • 2
  • 34
  • 58
20
votes
2 answers

SetValue on PropertyInfo instance error "Object does not match target type" c#

Been using a Copy method with this code in it in various places in previous projects (to deal with objects that have same named properties but do not derive from a common base class or implement a common interface). New place of work, new codebase -…
kpollock
  • 3,899
  • 9
  • 42
  • 61
18
votes
1 answer

How to set variable values while debugging in Visual Code using PHP debug?

I'm wondering how to set values of variables that I can see at a breakpoint while debugging in Visual Code. I'm using Version 1.20.1. I just can't press on Set Variable.
Mous Kamel
  • 257
  • 1
  • 2
  • 11
15
votes
8 answers

Setting a file upload field value - Javascript/jQuery

I have a form page that has a file upload field and I am trying to set the value of that field programmatically and although I know that it isn't possible due to security reasons, I would like to know if we still can? If there is a plugin or…
Neophile
  • 5,660
  • 14
  • 61
  • 107
15
votes
6 answers

How to stop the phone from charging via USB programmatically

I've tried to do as much research as possible but can't find an answer to this fairly simple question (want to figure this out before I'm going to set up the SDK and everything).I'm thinking about developing my first app and am wondering whether the…
Masi
  • 151
  • 1
  • 1
  • 3
14
votes
3 answers

Setting value in an array via reflection

Is there a way to set a single value in an array property via reflection in c#? My property is defined like this: double[] Thresholds { get; set; } For "normal" properties I use this code to set it via reflection: PropertyInfo pi =…
Boris
  • 8,551
  • 25
  • 67
  • 120
14
votes
1 answer

Using an array's SetValue method vs. the [] indexers

I noticed that arrays have the SetValue method, which seems a little out of place when you could just use the indexers. Is there some special purpose for SetValue? The MSDN article didn't seem to say what SetValue was for, just how to use it. …
Thick_propheT
  • 1,003
  • 2
  • 10
  • 29
12
votes
3 answers

how to set Value for extjs textfield?

i have a lot of textfields for userdata. and i wish to set it from DB. items: [{ xtype: "form", bodyPadding: 5, border: false, defaults: { …
r.r
  • 7,023
  • 28
  • 87
  • 129
8
votes
6 answers

extJS RadioGroup setValue() function

I have created RadioGroup using the code var radios = new Ext.form.RadioGroup({ columns : 2, items: [ {boxLabel: 'E-Mail', name: 'communication', inputValue: 1}, {boxLabel: 'Nagios', name: 'communication',…
Sapan
  • 83
  • 1
  • 1
  • 3
8
votes
1 answer

how do i set value of a textbox using javascript

I am trying to get a value fro query string and assign that value into a textbox. I am able to get the value from query string but unable to assign it to textbox. document.getElementByName('Contact0Email').Value = email; Tried the above code but…
Prady
  • 10,978
  • 39
  • 124
  • 176
1
2 3
24 25