update TableName set Datefield=cast(convert(varchar,datefield,106) as datetime)
Thursday, July 5, 2012
Tuesday, July 3, 2012
Save VsFlexGrid data to excel
- Private Sub FlexToExcel()
- Dim xlObject As Excel.Application
- Dim xlWB As Excel.Workbook
- Set xlObject = New Excel.Application
- 'This Adds a new woorkbook, you could open the workbook from file also
- Set xlWB = xlObject.Workbooks.Add
- Clipboard.Clear 'Clear the Clipboard
- With MSFlexGrid1
- 'Select Full Contents (You could also select partial content)
- .Col = 0 'From first column
- .Row = 0 'From first Row (header)
- .ColSel = .Cols - 1 'Select all columns
- .RowSel = .Rows - 1 'Select all rows
- Clipboard.SetText .Clip 'Send to Clipboard
- End With
- With xlObject.ActiveWorkbook.ActiveSheet
- .Range("A1").Select 'Select Cell A1 (will paste from here, to different cells)
- .Paste 'Paste clipboard contents
- End With
- ' This makes Excel visible
- xlObject.Visible = True
- End Sub
Monday, July 2, 2012
Binding Combobox at run time without using database connection via Dictionery Objec
Dim objDict As New Dictionary(Of String, String)
objDict.Add("1", "Value 1")
objDict.Add("2", "Value 2")
ComboBox1.DataSource = New BindingSource(objDict, Nothing)
ComboBox1.DisplayMember = "Value"
ComboBox1.ValueMember = "Key"
objDict.Add("1", "Value 1")
objDict.Add("2", "Value 2")
ComboBox1.DataSource = New BindingSource(objDict, Nothing)
ComboBox1.DisplayMember = "Value"
ComboBox1.ValueMember = "Key"
Saturday, June 30, 2012
Difference between Panel and GroupBox classes in .NET
The both classes that is Panel and GroupBox can be used as a container for other controls such as check box control, radio button control etc. But the difference between these two classes is
• In case of Panel class captions cannot be displayed i.e. we can’t set caption but in GroupBox class captions can be displayed.
• The Panel class can have scroll bars but GroupBox class cannot have scroll bar.
• In case of Panel class captions cannot be displayed i.e. we can’t set caption but in GroupBox class captions can be displayed.
• The Panel class can have scroll bars but GroupBox class cannot have scroll bar.
Thursday, June 28, 2012
Add row to bound Datagrideview
Dim dr As DataRow = CType(DgviewDetail.DataSource, DataTable).NewRow
dr.Item(1) = "anand"
'DgviewDetail.Rows.Add(dr)
CType(DgviewDetail.DataSource, DataTable).Rows.Add(dr)
Wednesday, June 13, 2012
excel connection string
ExcelCon = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + WorkBook + ";Extended Properties='Excel 8.0;HDR=YES;IMEX=1;';")
Subscribe to:
Posts (Atom)