I had this same problem a few months back, I had to reinstall visual studio as well as the framework. Try both. It worked for me.
Kevin Nicol
Posts
-
Unable to create an instance of datagrid in windows forms -
regarding datagrid problem in vb.net?The Arrow you can get rid of by not showing the row headers, there is a property that you can set this, and the plus you can get rid of by only binding a DataTable to the datagrid, and not a DataSet. so instead of
Datagrid1.datasource = dataset1
usedatagrid1.datasource = dataset1.tables(0)
-
XML -> VB.NET -> SQLI am not sure on the specifics of your problem, but depending on how the xml data is written, you could read it into a dataset using the schema.
dim data as new dataset() data.readXmlSchema("Schemafilename") data.readXml("xmlfilename")
and the data will now be in (a) table(s) in that dataset, like I said this will not work for a lot of xml data, but it is a start. -
Execute a Command Line App from Stored ProcedureThanks, works great. Whats the security risk?
-
Execute a Command Line App from Stored ProcedureHi All, I need to execute a command line executable from a stored procedure, any ideas on how I would do this? Thanks Kevin
-
Are arrays of objects possible ?try this
'declare the array dim plateInfo() as Plateobj 'set its bounds redim plateInfo(10) 'initialze the array item plateinfo(0) = new Plateobj() 'now work with it plateInfo(0).order = "One"
-
Are arrays of objects possible ?you still have to initialize the object as follows
Public Class Plateobj Public Order As String Public Row As String Public Column As String End Class Dim plateinfo() As Plateobj '***** plateinfo(0) = new plateobj() '***** plateinfo(0).Order = "One"
-
Help me with weird datagrid checkbox problemok This is how I would do that. Lets say you have a datatable (courseTable) with one column (A course ID). First add a second column to the table
courseTable.columns.add(new dataColumn("Delete"))
Setup the tablestyle for the bool columnDim style As New DataGridTableStyle style.GridColumnStyles.Clear() style.MappingName = courseTable.TableName Dim col As New DataGridBoolColumn col.MappingName = "Delete" col.HeaderText = "Delete" col.AllowNull = False style.GridColumnStyles.Add(col) DataGrid1.TableStyles.Add(style) DataGrid1.DataSource = courseTable
now you have the right setup for the bool column, just display it by adding rows to the datatable somehow from the database. so in your confirm button routine just check for deletesFor Each row As DataRow In courseTable.Rows If row.Item("Delete") Then 'This row was ticked so perform a delete End If Next
That should do it for you -
Help me with weird datagrid checkbox problemwell your normal textbox data column in the grid, displays all strings and numbers as text. It works the same for boolean columns. A DataGridBoolColumn will display true as checked, false as unchecked. So whatever column on your datatable is mapped to this DataGridBoolColumn will contain the true or false that is shown in the datagrid column. If you had a datatable (Two columns -> Name, Smoker) where smoker would be mapped to the DataGridBoolColumn, in each row in the table, a boolean would appear in the column smoker with resepct to the checked state of the textbox on the datagrid. Hope that helps.
-
Help me with weird datagrid checkbox problemtry treating cells in that column as bools
If row.item("deleteCheck") then Delete End if
-
click in datagrid's cellone possible solution would be to capture the datagrid's mouse up event and then select some other control such as a blank label or soemthing
Private Sub datagrid_MouseUp(ByVal sender As Object, _ ByVal e As System.Windows.Forms.MouseEventArgs) Handles dtgCategory.MouseUp label.Select() End Sub
-
DataGrid validationyou can declare the datatable that the datagrid is sourceing as an instance variable with events
Friend Withevents tab as Datatable
Then you can handle a variety of events related to editing that table such as NewRow and RowChanged -
make file excel(*.xls) from vb .NET 2003Here is a simple app that takes a dataset and writes a worksheet per data table in the set Public Sub writeToExcel(ByVal source As DataSet) Dim doc As New System.IO.StreamWriter("Excel.xls") 'use .xls even though its an xml file Dim startExcelXML As String = "" startExcelXML &= "" startExcelXML &= vbNewLine & "" 'write the styles tags that format the data and cells properly startExcelXML &= vbNewLine & "" startExcelXML &= vbNewLine & " " startExcelXML &= vbNewLine & " <Alignment ss:Vertical=""Bottom""/>" startExcelXML &= vbNewLine & " <Borders/>" startExcelXML &= vbNewLine & " <Font/>" startExcelXML &= vbNewLine & " <Interior/>" startExcelXML &= vbNewLine & " <NumberFormat/>" startExcelXML &= vbNewLine & " <Protection/>" startExcelXML &= vbNewLine & " " startExcelXML &= vbNewLine & "" startExcelXML &= vbNewLine & "<Alignment ss:Horizontal=""Center"" ss:Vertical=""Bottom""/>" startExcelXML &= vbNewLine & "<Font x:Family=""Swiss"" ss:Size=""8"" ss:Bold=""1""/>" startExcelXML &= vbNewLine & "<Interior ss:Color=""#C0C0C0"" ss:Pattern=""Solid""/>" startExcelXML &= vbNewLine & "" startExcelXML &= vbNewLine & " " startExcelXML &= vbNewLine & " <Font " + "x:Family=""Swiss"" ss:Bold""0""/>" startExcelXML &= vbNewLine & " " startExcelXML &= vbNewLine & "" 'write the header to the file doc.WriteLine(startExcelXML) 'write one sheet per table For Each tab As DataTable In source.Tables Dim sheetname As String = "" doc.WriteLine(sheetname) doc.WriteLine("") 'write t
-
Closing an applicationI don't think VB has any password Dialog Forms pre made so you would have to build a new form with a password box and pop it up when the unload event is raised. Then you can check the password with the hardcoded one. Kevin
-
Selecting datagrid cellsGive This a try
Datagrid1.CurrentCell = new Windows.Forms.DatagridCell(row, col)
Kevin -
Problem in SQL Connectivity codeThe Problem is you are not setting the connection or command type of your select command. Add these two lines right before you execure the reader
selectCommand.Connection = conn selectCommand.CommandText = CommandType.Text
Hope this works Kevin -
DataGrid ParentRowTry this
datagrid.CurrentRowIndex = someIndex
That works for me. Kevin -
How to BindingData to RadioButtonThat was pretty vague but if I understand correctly there are 3 fields in a table in the database, and you want to use the radio buttons to choose which field to select from?
dim Field as string IF rdb1.checked THEN field = 'field name else if rdb2.checked THEN field = 'field name 2 else field = 'field name 3 end if
Thas pretty bad programing style but for purpose of explination it will suffice Now you perform the select statementSomeAdapter.SelectCommand.CommandText = "SELECT " & Field & " FROM some table WHERE somecontraints
hope that helps -
How to BindingData to RadioButtonI don't think Binding the radio buttons to a database is even possible in that manner, and if it is I don't think its the right way to go about it. What you would probably want to do is handle the
RadioButton.CheckChaged
Event and then do an insert or update statement using a SLQDataAdapter or SQLCommand. Kevin -
How to BindingData to RadioButtonI don't think anyone can understand the Question, what is you want to bind the Radio buttons to? Do you want the radio button text to come from the Database? Or the useres selection be logged in the database?