Click here to Skip to main content
15,434,299 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionRe: Winforms VB.Net: Best way to code rules for german cards game "Schafkopf"? Pin
Eddy Vluggen20-May-22 4:15
professionalEddy Vluggen20-May-22 4:15 
AnswerRe: Winforms VB.Net: Best way to code rules for german cards game "Schafkopf"? Pin
Jo_vb.net20-May-22 5:07
MemberJo_vb.net20-May-22 5:07 
GeneralRe: Winforms VB.Net: Best way to code rules for german cards game "Schafkopf"? Pin
Gerry Schmitz20-May-22 5:30
mveGerry Schmitz20-May-22 5:30 
QuestionRe: Winforms VB.Net: Best way to code rules for german cards game "Schafkopf"? Pin
Eddy Vluggen20-May-22 6:08
professionalEddy Vluggen20-May-22 6:08 
AnswerRe: Winforms VB.Net: Best way to code rules for german cards game "Schafkopf"? Pin
Gerry Schmitz21-May-22 5:36
mveGerry Schmitz21-May-22 5:36 
GeneralRe: Winforms VB.Net: Best way to code rules for german cards game "Schafkopf"? Pin
Jo_vb.net20-May-22 6:21
MemberJo_vb.net20-May-22 6:21 
GeneralRe: Winforms VB.Net: Best way to code rules for german cards game "Schafkopf"? Pin
Jo_vb.net29-May-22 0:42
MemberJo_vb.net29-May-22 0:42 
GeneralRe: Winforms VB.Net: Best way to code rules for german cards game "Schafkopf"? Pin
Gerry Schmitz29-May-22 4:58
mveGerry Schmitz29-May-22 4:58 
GeneralRe: Winforms VB.Net: Best way to code rules for german cards game "Schafkopf"? Pin
Eddy Vluggen20-May-22 6:07
professionalEddy Vluggen20-May-22 6:07 
GeneralRe: Winforms VB.Net: Best way to code rules for german cards game "Schafkopf"? Pin
Jo_vb.net20-May-22 6:26
MemberJo_vb.net20-May-22 6:26 
QuestionRe: Winforms VB.Net: Best way to code rules for german cards game "Schafkopf"? Pin
Eddy Vluggen20-May-22 8:10
professionalEddy Vluggen20-May-22 8:10 
AnswerRe: Winforms VB.Net: Best way to code rules for german cards game "Schafkopf"? Pin
Jo_vb.net20-May-22 8:56
MemberJo_vb.net20-May-22 8:56 
SuggestionRe: Winforms VB.Net: Best way to code rules for german cards game "Schafkopf"? Pin
Eddy Vluggen20-May-22 23:02
professionalEddy Vluggen20-May-22 23:02 
QuestionUpdating datagridview with image Pin
Jake Mazur17-May-22 3:23
MemberJake Mazur17-May-22 3:23 
Hi! Can somebody help me. I am beginner. I have a project and need to update datagridview with image column, using Access databse. I have code for insert new row with image and as I understand it can be modified for updating row. I try to modify, but problem is not working. Now no any alarms or errors occurs, database not changed.
Many thanks un advance.

<pre> Private Sub Btn_Save_Click(sender As Object, e As EventArgs) Handles Btn_Update.Click


        Try
            If PhotoPictureBox.Image Is Nothing Then
                If MsgBox("Are you sure you don't want to upload any pictures?", MsgBoxStyle.Information + MsgBoxStyle.YesNo, "Missing picture") Then
                    Dim CN As New OleDbConnection(connection)
                    CN.Open()

                    Dim Int As String
                    Int = "UPDATE Germany set [Year_of_release]=@year_of_release, [Denomination]=@denomination, [Governing_body]=@governing_body, [Acquired]=@acquired, [Date_of_purchase]=@date_of_purchase, [Course]=@course, [Material]=@material WHERE [ID]=@ID"


                    Dim cmd As New OleDbCommand(Int, CN)

                    'cmd.Parameters.Add("@ID", OleDbType.VarChar).Value = IDTextBox.Text
                    cmd.Parameters.Add("@year_of_release", OleDbType.VarChar).Value = Year_of_releaseDateTimePicker.Value
                    cmd.Parameters.Add("@denomination", OleDbType.VarChar).Value = DenominationTextBox.Text
                    cmd.Parameters.Add("@governing_body", OleDbType.VarChar).Value = Governing_bodyTextBox.Text
                    cmd.Parameters.Add("@acquired", OleDbType.VarChar).Value = AcquiredTextBox.Text
                    cmd.Parameters.Add("@date_of_purchase", OleDbType.VarChar).Value = Date_of_purchaseDateTimePicker.Value
                    cmd.Parameters.Add("@course", OleDbType.VarChar).Value = CourseTextBox.Text
                    cmd.Parameters.Add("@material", OleDbType.VarChar).Value = MaterialTextBox.Text

                    cmd.ExecuteNonQuery()

                    cmd.Dispose()
                    CN.Close()
                    CN.Dispose()
                End If

            Else
                If imgName <> "" Then
                    Dim fs As FileStream
                    fs = New FileStream(imgName, FileMode.Open, FileAccess.Read)

                    Dim picturebytes As Byte() = New Byte(fs.Length - 1) {}
                    fs.Read(picturebytes, 0, System.Convert.ToInt32(fs.Length))
                    fs.Close()

                    Dim CN As New OleDbConnection(connection)
                    CN.Open()

                    Dim Int As String
                    Int = "UPDATE Germany set [Year_of_release]=@year_of_release, [Denomination]=@denomination, [Governing_body]=@governing_body, [Acquired]=@acquired, [Date_of_purchase]=@date_of_purchase, [Course]=@course, [Material]=@material, [Photo]=@photo WHERE [ID]=@ID"


                    Dim imgparam As New OleDbParameter()
                    imgparam.OleDbType = OleDbType.Binary
                    imgparam.ParameterName = "@photo"
                    imgparam.Value = picturebytes

                    Dim cmd As New OleDbCommand(Int, CN)

                    cmd.Parameters.Clear()
                    cmd.Parameters.Add("@ID", OleDbType.VarChar).Value = IDTextBox.Text
                    cmd.Parameters.Add("@year_of_release", OleDbType.VarChar).Value = Year_of_releaseDateTimePicker.Value
                    cmd.Parameters.Add("@denomination", OleDbType.VarChar).Value = DenominationTextBox.Text
                    cmd.Parameters.Add("@governing_body", OleDbType.VarChar).Value = Governing_bodyTextBox.Text
                    cmd.Parameters.Add("@acquired", OleDbType.VarChar).Value = AcquiredTextBox.Text
                    cmd.Parameters.Add("@date_of_purchase", OleDbType.VarChar).Value = Date_of_purchaseDateTimePicker.Value
                    cmd.Parameters.Add("@course", OleDbType.VarChar).Value = CourseTextBox.Text
                    cmd.Parameters.Add("@material", OleDbType.VarChar).Value = MaterialTextBox.Text
                    cmd.Parameters.Add(imgparam)

                    cmd.ExecuteNonQuery()

                    cmd.Dispose()
                    CN.Close()
                    CN.Dispose()

                End If





            End If
        Catch ex As Exception
            MsgBox(ex.Message.ToString)
        End Try


    End Sub

AnswerRe: Updating datagridview with image Pin
Richard MacCutchan17-May-22 3:30
mveRichard MacCutchan17-May-22 3:30 
QuestionUpdating datagridview with image Pin
Jake Mazur17-May-22 3:20
MemberJake Mazur17-May-22 3:20 
AnswerRe: Updating datagridview with image Pin
Richard Deeming17-May-22 4:10
mveRichard Deeming17-May-22 4:10 
Questionxml with control createinfo Pin
JR21214-May-22 19:59
MemberJR21214-May-22 19:59 
AnswerRe: xml with control createinfo Pin
Richard MacCutchan14-May-22 21:02
mveRichard MacCutchan14-May-22 21:02 
AnswerRe: xml with control createinfo Pin
Dave Kreskowiak15-May-22 4:58
mveDave Kreskowiak15-May-22 4:58 
GeneralRe: xml with control createinfo Pin
JR21216-May-22 8:26
MemberJR21216-May-22 8:26 
GeneralRe: xml with control createinfo Pin
Richard MacCutchan16-May-22 9:09
mveRichard MacCutchan16-May-22 9:09 
GeneralRe: xml with control createinfo Pin
Dave Kreskowiak16-May-22 9:58
mveDave Kreskowiak16-May-22 9:58 
GeneralRe: xml with control createinfo Pin
JR21218-May-22 23:16
MemberJR21218-May-22 23:16 
Questionhow to make .OBJ 3D model viewer for vb.net 2010 Pin
Android Oyunları9-May-22 7:12
MemberAndroid Oyunları9-May-22 7:12 

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.