[Solved] Cannot implicitly convert type ‘object’ to ‘int’. An explicit conversion error exists

The first error is because of this: Array myPort;. That’s not how you declare an array, Array is an abstract class that provides methods to operate on arrays. SerialPort.GetPortNames() returns a string array so you can either declare a string array or just remove the Array myPort; declaration and replace the other line with var … Read more

[Solved] I want datetimepicker.mindate < datetimepicker1.value [closed]

Your exception is telling you that have to give dateTimePicker1 a value. Also, the order you do things is important. You can’t set dateTimePicker1’s value to less than the MinDate. That’s the purpose of having a MinDate. You must first modify the MinDate, then set the value. dateTimePicker1.MinDate = DateTime.Parse(comboBox3.Text); // -> contains a date … Read more

[Solved] Replace filename in textbox [closed]

To get absolute path of that file use Path.GetDirectoryName(filePath) and combine it with new file name. You will get new file path If I understood it correctly, then in your case: text1.Text contains full file path. i.e.E:\Files\sample.pdf text2.Text contains new file name. i.e. newfilename.pdf On button_ClickEvent() you want new file name path. i.e. E:\Files\newfilename.pdf Implement … Read more

[Solved] Run progress bar until being logged in, because sometimes internet speed is slow and some times it is fast. (C#, Windows Form Application) [closed]

private async void button1_Click(object sender, EventArgs e) { await TimeConsumingOperation(); } public async Task TimeConsumingOperation() { progressBar1.Visible = true; progressBar1.Style = ProgressBarStyle.Marquee; await Task.Delay(10000); progressBar1.Visible = false; } 1 solved Run progress bar until being logged in, because sometimes internet speed is slow and some times it is fast. (C#, Windows Form Application) [closed]

[Solved] Call the maximum from SQL table to textbox

You could design your database table using an IDENTITY column. The database will assign a next value for the inserted row. You can access the value using one of: SCOPE_IDENTITY, @@IDENTITY or IDENT_CURRENT. More can be found here: MSDN-Identity. To know the difference between SCOPE_IDENTITY and @@IDENTITY see here. solved Call the maximum from SQL … Read more

[Solved] C# form pass values to another [closed]

Please refer to the following MSDN page on passing parameters: http://msdn.microsoft.com/en-us/library/0f66670z(v=vs.71).aspx Personally, I would do data access in a separate class and implement a public void Login(string user, string password, string server) method. The second form would then make use of this class’s other methods to retrieve and display data. 3 solved C# form pass … Read more

[Solved] Update variable on each loop [closed]

You’ll need a place to hold your current value, in the example I’ve made it to be a local named pageNum. Inside your loop then, you’ll increment that variable and assign it to the Page property on the PlayerSearchParameters object being constructed in its initializer. If you want the method to wait for the async … Read more

[Solved] How to show date in diffrent way in GridView?

It is easier for me to answer my question than isolated working code in my complex program. So this is my hack that works inside my program: private void GridView_CustomDrawEvent(object sender, RowCellCustomDrawEventArgs e) { if(e.Column.FieldName == “CreationDate”) { string date = ((DateTime) view.GetRowCellValue(e.RowHandle, “CreationDate”)); string displayDate = date.ToShortDateString() + ” ” time.ToLongTimeString(); e.DisplayText = displayDate; … Read more

[Solved] How to set values of text box using values of other text boxes [closed]

I think what you want is Control.Leave event or Control.KeyPress or you may also use Control.TextChanged as suggested by @LevZ… Here is some code for Control.Leave Event: TextBoxFirstNumber.Leave += TextBoxFirstNumber_Leave; TextBoxSecondNumber.Leave += TextBoxSecondNumber_Leave; void TextBoxFirstNumber_Leave(object sender, EventArgs e) { if (TextBoxFirstNumber.Text != “” && TextBoxSecondNumber.Text != “”) { TextBoxAnswer.Text = int.Parse(TextBoxFirstNumber.Text) * int.Parse(TextBoxSecondNumber.Text); } } … Read more

[Solved] How to post new messages in every function call?

You can use Listfor this problem. Instead if _lines of type string array use List<KeyValuePair<string,bool>> _lines; And the condition should be if (ScrollLabel._lines[i].Key.Contains(WordsList.words[x]) && !_lines[i].Value) { _lines[i].Value = true; … … } solved How to post new messages in every function call?

[Solved] That TextBox should retain the same value even after closing the form? [closed]

You might want to use User Settings. They’re different from Application Settings because they can be read and write between different sessions of the same applications. You can create a new setting at design time: Solution Explorer > Properties Double-click on the .settings file (this creates a new set in the default settings). Set name … Read more