CS1525 C# Invalid expression term 'string' [closed] - c#

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have this error and I have no ideo about what should I do
The aim is when I click to button, it should read the word in textbox and save it into the string variable by its new factor.I have the error oin the topic
private void panel_button_kelimeekle_kaydet_Click(object sender, EventArgs e)
{
if(panel_checkbox_ing.Checked)
{
string (panel_textbox_kelimeekle_yab.Text) = Ingkelimeler[(Ingkelimeler.Length+1)];
}
}

If panel_textbox_kelimeekle_yab is already a textbox on your form, then you don't need to declare its type when you assign a value to it. C# thinks you're trying to declare a new string variable.
Change that line of code to
panel_textbox_kelimeekle_yab.Text = Ingkelimeler[(Ingkelimeler.Length+1)];
This probably won't solve all your problems, but at least it will get you on to the next error message. (You probably mean Length-1 in your array index, but there's really no way for us to know.)

Related

Understanding the parameters of a functions provided through manual [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I am working on a Laser system. The system comes with it's own manual, including an SDK reference, but I need help on understanding the definition of a function included in the reference:
and
To use this function, I have this code:
private void BrightnessButton_Click(object sender, EventArgs e)
{
Double setBrightness;
laser.setDispBrightness(out setBrightness);
}
But it keeps giving me this error:
may not be passed with the 'out keyboard'" << I think you meant 'keyword'
They also provided me with the sample code below:
How can I make this work? Any help in understanding how to program just simply the brightness would be appreciated. I am having trouble understanding what to put in for the parameters. Thanks
Only use an out variable when calling the get versions of the function. When calling the set versions of the function, you should have already set a value for the variable:
private void BrightnessButton_Click(object sender, EventArgs e)
{
Double setBrightness = .5; // set to 50%
laser.setDispBrightness(setBrightness);
}

Notepad in c# Replace All [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have made replace function, but I am really struggling to make "Replace All"
function.
I tried to make into for loop but that didn't work well...
I have dialog box just like in usual Notepad (another form) and i have richtextbox in Main form. Any ideas how can I make it?
You can simply use the String.Replace method:
private void DoReplace(string SearchFor, string ReplaceWith)
{
RichTextBox1.Text = RichTextBox1.Text.Replace(SearchFor, ReplaceWith);
}
Call this function and supply the string you want to search for in Richtextbox1 (or whatever it is called in your case) as the first parameter and the replacement as the second parameter.

Access part of the list in c# [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have this two list here:
List<KeyValuePair<TextBox, KeyValuePair<string, Type>>> textbox1
So, i need that to get the Textbox i need to write:
textbox1.Key
What should i type to get the KeyValuePair<string, Type>> Type, like textbox1.Value.Value?
The type contains string or int.What i need is to access it's value so i can assign an if operator but i don't know how to. Then i need to modify it but that's my next step and i can arrange that myself.
I suppose textbox1.Key won´t compile since textbox1 is a List and therefor does not have any member called Key. Having said this the following may work for you:
textbox[i].Value.Value
Where i is the index of your KV-pair within the list (rather then the actual key)

Why does C# allow creating an object with the same reference? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Here is an example of my code:
Button1_Click(object sender, EventArgs e)
{
PictureBox PB = new PictureBox;
PB.Name = TextBox1.Text;
}
In this code when a user clicks the button, a new object of type PictureBox will be created. Then Name will be assigned the object. How's this possible?
I mean if user clicks again, another object with same reference will be created. How's this possible?
How's this possible?
The Name property on a Control is just a string property - you can assign it anything you want, so having multiple controls with the same name is just the same as having multiple text boxes displaying the same text, or any other class with a string property.
Note that, in your case, you're not actually using or storing the PictureBox you create in any way, so it's going to be eligible for GC as soon as your method ends.

Query String operator assignment error [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm going to send back data to my sms gateway.first i have a querystring like this.
string mobileNo = Request.QueryString["msisdn"];
int dest = int.Parse(Request.QueryString["shortcode"].ToString());
string messageIn = Request.QueryString["msg"];
string operatorNew = Request.QueryString["operator"];
Then i'm going to assign a variables to it.
public void sendReply(string messageOut)
{
messageOut = "http://mygateway.com/api/mt?msisdn=mobileNo&body=msg&sender=shortcode&key=nvqow9rhfp&product_id=2116&operator=OperatorNew&country=us";
}
But i'm getting operator assignment error..
Check this.This parameter is wrong.this param not supplied.
&body=msg
Please verify your Key & Product id with the gateway owners.

Categories