Resolved Datagrid view Select Question

kasteel

Well-known member
Joined
May 29, 2009
Messages
50
Programming Experience
10+
Hi

Hope someone can help me. :)

I am using a datagrid view on a small app. In my access database I have 4 vbscript file names + paths in one column. (Example: "c:\test.vbs")

There is a second column where users can select which script they want to run. (Like a Yes / No column)

Then I have a run button at the bottom of the form.

How can I program my button to only run vbscripts that are marked as Yes from the YesNo column? I am planning to run the vbscripts with the following command: System.Diagnostics.Process.Start("C:\test.vbs")

Any help would be appreciated. :)
 
Last edited:
Hi

Thanks for the reply. The code did not work for me though.

I tried:

VB.NET:
        For Each row As DataRow In mydbDataSet.Table1.Rows
            If CBool(row("Check")) Then
                Process.Start(CStr(row("RunThis")))
            End If
        Next

My column names are called "Check" and "RunThis". Nothing happens when I press the button. I am using an access database and formatted (data type) the "Check" column as "Yes/No".
 
Hi

I double checked and at least one row was checked. Not sure what else I can try. :(

I also tried this just to see if it works but had no luck:

VB.NET:
        For Each row As DataRow In AutomatedbDataSet.Table1.Rows
            If CBool(row("Check")) Then
                'Process.Start(CStr(row("RunThis")))
                MsgBox("Hello")
            End If
        Next
 
If any rows in that DataTable contained True in the Check column then that code would act on them, so that means that that DataTable contains no such rows. That suggests that whatever you're doing in your grid is having no effect on that column of that DataTable. Why that is is impossible for us to say from the information we have.
 
I noticed that when I click on the checkbox in the database itself and then save the database it works. But when I check the checkbox in the datagrid itself it does not work. That is very weird. :(
 
Ahhh :)

It works now :)

I just added:

VB.NET:
        Me.Validate()
        Me.Table1BindingSource.EndEdit()
        Me.Table1TableAdapter.Update(Me.AutomatedbDataSet.Table1)

Before running the other code

Thanks for your help. I appreciate it. :)
 
Back
Top