Click here to Skip to main content
15,894,539 members
Home / Discussions / C#
   

C#

 
QuestionC# code to chart sometimes charting blank charts Pin
Iskander1234530-Nov-23 16:01
Iskander1234530-Nov-23 16:01 
AnswerRe: C# code to chart sometimes charting blank charts Pin
Ralf Meier30-Nov-23 21:12
mveRalf Meier30-Nov-23 21:12 
GeneralRe: C# code to chart sometimes charting blank charts Pin
Iskander123451-Dec-23 0:52
Iskander123451-Dec-23 0:52 
GeneralRe: C# code to chart sometimes charting blank charts Pin
Ralf Meier1-Dec-23 2:03
mveRalf Meier1-Dec-23 2:03 
GeneralRe: C# code to chart sometimes charting blank charts Pin
Iskander123451-Dec-23 4:43
Iskander123451-Dec-23 4:43 
GeneralRe: C# code to chart sometimes charting blank charts Pin
Ralf Meier1-Dec-23 6:18
mveRalf Meier1-Dec-23 6:18 
SuggestionRe: C# code to chart sometimes charting blank charts Pin
Richard Deeming30-Nov-23 21:56
mveRichard Deeming30-Nov-23 21:56 
AnswerRe: C# code to chart sometimes charting blank charts Pin
Richard MacCutchan30-Nov-23 22:15
mveRichard MacCutchan30-Nov-23 22:15 
GeneralRe: C# code to chart sometimes charting blank charts Pin
Iskander123451-Dec-23 0:23
Iskander123451-Dec-23 0:23 
GeneralRe: C# code to chart sometimes charting blank charts Pin
Richard MacCutchan1-Dec-23 2:06
mveRichard MacCutchan1-Dec-23 2:06 
AnswerRe: C# code to chart sometimes charting blank charts Pin
Dave Kreskowiak1-Dec-23 5:02
mveDave Kreskowiak1-Dec-23 5:02 
GeneralRe: C# code to chart sometimes charting blank charts Pin
Andre Oosthuizen1-Dec-23 22:30
mveAndre Oosthuizen1-Dec-23 22:30 
AnswerRe: C# code to chart sometimes charting blank charts Pin
jschell1-Dec-23 6:35
jschell1-Dec-23 6:35 
AnswerRe: C# code to chart sometimes charting blank charts Pin
Gerry Schmitz2-Dec-23 8:02
mveGerry Schmitz2-Dec-23 8:02 
GeneralRe: C# code to chart sometimes charting blank charts Pin
Iskander123452-Dec-23 16:02
Iskander123452-Dec-23 16:02 
Questionc# code Pin
j k Nov202329-Nov-23 17:13
j k Nov202329-Nov-23 17:13 
AnswerRe: c# code Pin
lmoelleb29-Nov-23 19:31
lmoelleb29-Nov-23 19:31 
GeneralRe: c# code Pin
j k Nov202329-Nov-23 20:04
j k Nov202329-Nov-23 20:04 
AnswerRe: c# code Pin
jschell30-Nov-23 6:05
jschell30-Nov-23 6:05 
AnswerRe: c# code Pin
Andre Oosthuizen1-Dec-23 22:35
mveAndre Oosthuizen1-Dec-23 22:35 
GeneralRe: c# code Pin
j k Nov20232-Dec-23 20:34
j k Nov20232-Dec-23 20:34 
GeneralRe: c# code Pin
Andre Oosthuizen3-Dec-23 2:35
mveAndre Oosthuizen3-Dec-23 2:35 
QuestionConverting string into non-string Form.Object types for passing to methods or updating non-string object.Property with strings Pin
Codice Fictor26-Nov-23 12:19
Codice Fictor26-Nov-23 12:19 
Hello & Salutations to Everyone, using: Win Forms .NET 4.7.2
I have a set of Form buttons named button1, button2, button3,………
I have an array of strings BUTTON_LIST_str[] =” button1”, “button2”, “button3”,…
I have a function:
private void APPLY_BUTTON_CFG(Button b)
{ …………… }

What I need to do is loop through BUTTON_LIST_str[] and pass each button object to APPLY_BUTTON_CFG(Button b).
Basically for every string I need to use for pointing to a different type form object or its property of object, I get the error "String cannot be converted to the object required type/format (System.Form......)

I have searched every convoluted order of words for hours and cannot find a solution that matched my scenario of converting strings to all form object types (or specific ones either). With so many unique object specific variables how does one research the solution to convert a string to each type for each case?
Is there a ConvertToType universal function that solves this issue.

I also ran into same problem with:

FlatStyle P_STYLE = “Flat”;
Button1.FlatStyle = P_STYLE or FlatStyle.P_STYLE ; // error cannot convert string to…………..FlatStyle object type

I understand that a string name cannot point to a form object OOP when passing to a function. I’m not sure I can ask my question competently………….

With so many unique object specific variables how does one research the string conversion solution for each case?

Simply put, how would I research and find the solution for these types of problems:

Button1.FlatStyle = How to convert string to FlatStyle object reference, or Font, TextAlign when an error occurs?

I did find this translator for colors but not FlatStyle though or for any other applicable parameters.
P_COLOR = System.Drawing.ColorTranslator.FromHtml("White"); //"White" will be replaced with a string array element CFG_PARAM_PARSED[2]);
Button1.ForeColor = P_COLOR;

This is the real kicker: Button name as string (String_Array[x]) needs conversion (typecast?) to object name reference

var ButtonObject = String_Array[x]; or Button ButtonObject = String_Array[x];
APPLY_BUTTON_CFG(ButtonObject);

private void APPLY_BUTTON_CFG(Button b)
{
……………
}

Thank You So Much for your time and assistance…………………….
AnswerRe: Converting string into non-string Form.Object types for passing to methods or updating non-string object.Property with strings Pin
Dave Kreskowiak26-Nov-23 14:07
mveDave Kreskowiak26-Nov-23 14:07 
GeneralRe: Converting string into non-string Form.Object types for passing to methods or updating non-string object.Property with strings Pin
Codice Fictor26-Nov-23 15:52
Codice Fictor26-Nov-23 15:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.