Click here to Skip to main content
14,975,553 members

Comments by BASSIES (Top 19 by date)

BASSIES 5-Feb-19 15:00pm View
Is there a better way , and not from a database.
BASSIES 5-Feb-19 14:58pm View
This is working , find last row but it is slow

Private Sub copyAlltoClipboard()
Dim dataObj As DataObject = DataGridView1.GetClipboardContent()
If dataObj IsNot Nothing Then Clipboard.SetDataObject(dataObj)
End Sub
Private Sub copyAlltoClipboard2()
Dim dataObj As DataObject = DataGridView2.GetClipboardContent()
If dataObj IsNot Nothing Then Clipboard.SetDataObject(dataObj)
End Sub

Private Sub Crew2()
Dim xlexcel As Excel.Application
Dim xlWorkBook As Excel.Workbook
Dim xlWorkSheet As Excel.Worksheet
xlexcel = New Excel.Application
xlexcel.Visible = True
xlWorkBook = xlexcel.Workbooks.Open("C:\weg\Verbruik.xlsx")
xlWorkSheet = xlWorkBook.Worksheets(1)

Dim CR As Excel.Range = xlWorkSheet.Cells(37, 1)

Dim lastRow As Integer = xlWorkSheet.UsedRange.Rows.Count

Dim emptyRow As Integer = lastRow + 3

lastRow = xlWorkSheet.UsedRange.Rows.Count
'This is next emptyRow in the sheet
emptyRow = lastRow + 3

Dim CR1 As Excel.Range = xlWorkSheet.Cells(emptyRow, 1)

End Sub
BASSIES 22-Jan-19 10:26am View
Thanks Bryian ,

I can remove it if wanted.
BASSIES 22-Jan-19 8:38am View
Bryian ,

Was searching on your hint to look for dataGridView1.SelectedRows

Found this , it works but the text is not seperated with -
Tryed to ajust but no luck

The outcome is BenEricJohn no - between the name's

Dim message As String = String.Empty
For Each row As DataGridViewRow In DataGridView1.Rows
Dim isSelected As Boolean = Convert.ToBoolean(row.Cells("chk").Value)
If isSelected Then
message &= Environment.NewLine
message &= row.Cells("name").Value.ToString()
End If

TextBox1.Text = ("Selected Values" & message)

what do i change here with textBox1.text= (..........
BASSIES 21-Jan-19 7:47am View
I can't start the debug because of the error on names

the error is

List(Of String)' cannot be converted to 'String()
BASSIES 20-Jan-19 9:23am View
Found another converter

Dim names As List(Of String) = New List(Of String)
For Each r As DataGridViewRow In DataGridView1.Rows
Dim isSelected As Boolean = Convert.ToBoolean(r.Cells("Chk").Value)
If isSelected Then
End If

MessageBox.Show(String.Join(" - ", names))

Get an error on names
List(Of String)' cannot be converted to 'String()
BASSIES 20-Jan-19 7:04am View
Thanks for your answer Bryian , but i can't transform the code to

There is an error

Error converting code
Error message:
CONVERSION ERROR: Conversion for IncompleteMember not implemented, please report this issue in '(DataGridViewRow r ' at character 88
BASSIES 13-Jan-19 8:58am View
Thanks Richard
BASSIES 10-Jan-19 3:03am View
Thanks Wendelius , just what i was looking for.
BASSIES 9-Jan-19 16:59pm View
cmd = New SqlCeCommand("Select Id, Name FROM Product WHERE Name <>''", con)
If con.State = ConnectionState.Closed Then con.Open()
Dim sdr As SqlCeDataReader = cmd.ExecuteReader()
While sdr.Read = True
TextBox5.Text = (sdr.Item("Name"))
End While

This is only showing the last item
BASSIES 31-Dec-18 4:55am View
Patrice T,

Like this ?

cmd = New SqlCeCommand("UPDATE Cijfers Set Kg= @Kg Where Id = @Id", con)
If con.State = ConnectionState.Closed Then con.Open()
cmd.Parameters.Add("@Id", SqlDbType.NVarChar).Value = Cijfersid.Text
cmd.Parameters.Add("@Kg", SqlDbType.Decimal).Value = Kg.Text
BASSIES 30-Dec-18 15:44pm View
Thanks OriginalGriff and Patrice T ,

Learned al lot with this question, i must read more about SQL Injection.

Now it was a litte thing to change the update so early in my programm.
BASSIES 29-Dec-18 17:32pm View
This is working or am i reading it wrong about sql injection.

A different example with a column in Nvarchar , where it crased before and now it is saving

cmd = New SqlCeCommand("UPDATE Gevaren Set Vertrekvaren = @Vertrekvaren Where Id='" & Gevarenid.Text & "'", con)
If con.State = ConnectionState.Closed Then con.Open()
cmd.Parameters.Add("@Vertrekvaren", SqlDbType.NVarChar).Value = Vertrekvaren.Text
BASSIES 29-Dec-18 16:42pm View
OriginalGriff ,

You are wright also , but i was focused on the update and didnot understand SQL Injection.

And Yes i have a problem
BASSIES 29-Dec-18 16:38pm View
Thanks for the warning,

And it crased , do you have an example ho i update this .

Reading something about it but can't really figure it out what to change.

cmd = New SqlCeCommand("Update Gegevens Set Kg ='" & Kg.Text & "' Where Id='" & Gegevensid.Text & "'", con)
BASSIES 29-Dec-18 9:56am View
Hello ,

Found something after your answer , I write it to the database as Decimal with a comma

Get the value from the database and it is with a comma . Fine that is how i want to see it in the textbox.

When i Update i have to use a dot ?

Dont know why but i works.

Never have to do that with a dot , maybe i am using the 2017 version now ?

BASSIES 29-Dec-18 8:56am View

The input of the textbox is for example 14,025

This is Decimal with 3 behind the comma

What am i missing
BASSIES 20-Dec-15 6:37am View
Or anyone has another code to fill the chartcontrol with data from textboxes
BASSIES 31-Aug-11 4:55am View
Thanks ,

But i don't know very much about Function's.

How do i put this in my code ? and where.