Click here to Skip to main content
15,891,657 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: vb .net - Moving to a new computer Pin
Dave Kreskowiak13-Jun-12 8:12
mveDave Kreskowiak13-Jun-12 8:12 
GeneralRe: vb .net - Moving to a new computer Pin
No-e13-Jun-12 9:48
No-e13-Jun-12 9:48 
GeneralRe: vb .net - Moving to a new computer Pin
Richard MacCutchan13-Jun-12 22:46
mveRichard MacCutchan13-Jun-12 22:46 
QuestionHow to Print this array in word?(VBA) Pin
godevg12-Jun-12 21:23
godevg12-Jun-12 21:23 
AnswerRe: How to Print this array in word?(VBA) Pin
Andy_L_J12-Jun-12 21:57
Andy_L_J12-Jun-12 21:57 
QuestionLimit picture size in picture box Pin
Midnight Ahri10-Jun-12 22:51
Midnight Ahri10-Jun-12 22:51 
AnswerRe: Limit picture size in picture box Pin
Eddy Vluggen11-Jun-12 0:09
professionalEddy Vluggen11-Jun-12 0:09 
QuestionVB.NET : Datagrid's scrolling giving error after selecting row Pin
Nitin Varshneya8-Jun-12 5:02
Nitin Varshneya8-Jun-12 5:02 
When I am scrolling datagrid after selecting one row I am getting error as "An unhandled exception of type System.StackOverflowException occurred in System.Windows.Forms.dll" on line :

MyBase.Edit(source, rowNum, bounds, [readOnly], instantText, cellIsVisible)


Whole code is given below :



' Hosts a TextBox control in a cell of a DataGridColumnStyle for editing strings.
'
' Note:
' Adds the ability to change the color of an individual cell. As each row in the column is
' painted an event is fired that allows the setting of the new color.

' Added returning the cell value when it's being painted. Also if the row is selected the
' selection colors will be used.
'-----------------------------------------------------------------------------------------------'

' Additional namespaces.
Imports System.Windows.Forms
Imports System.Drawing

Public Class FormatableCellDataGridTextBoxColumn

' Base class.
Inherits DataGridTextBoxColumn

' Delegates.
Public Delegate Sub PaintingCellEventHandler( _
ByVal sender As Object, _
ByVal e As PaintingCellEventArgs)
Public Delegate Sub EditingCellEventHandler( _
ByVal sender As Object, _
ByVal e As EditingCellEventArgs)

' Events.
Public Event PaintingCell As PaintingCellEventHandler
Public Event EditingCell As EditingCellEventHandler

' Instance variables.
Private _columnNum As Integer

Public Sub New(ByVal columnNum As Integer)


' Initialize instance variables.
_columnNum = columnNum

End Sub

Protected Overloads Overrides Sub Paint( _
ByVal g As System.Drawing.Graphics, _
ByVal bounds As System.Drawing.Rectangle, _
ByVal source As System.Windows.Forms.CurrencyManager, _
ByVal rowNum As Integer, _
ByVal backBrush As System.Drawing.Brush, _
ByVal foreBrush As System.Drawing.Brush, _
ByVal alignToRight As Boolean)


' Local variables.
Dim foreColor As Color
Dim backColor As Color
Dim rowIsSelected As Boolean = False
Dim text As String = NullText
Dim value As Object = GetColumnValueAtRow(source, rowNum)
Dim arg As PaintingCellEventArgs

' Determine if the row is selected.
If TypeOf foreBrush Is SolidBrush AndAlso TypeOf backBrush Is SolidBrush Then
foreColor = DirectCast(foreBrush, SolidBrush).Color
backColor = DirectCast(backBrush, SolidBrush).Color
If _
foreColor.Equals(DataGridTableStyle.SelectionForeColor) AndAlso _
backColor.Equals(DataGridTableStyle.SelectionBackColor) Then
rowIsSelected = True
End If
End If

' Retrieve brushes.
If Not IsDBNull(value) Then text = value.ToString()
arg = New PaintingCellEventArgs( _
rowNum, _
_columnNum, _
text, _
backBrush, _
foreBrush)
If Not rowIsSelected Then RaiseEvent PaintingCell(Me, arg)

' Paint the cell.
MyBase.Paint(g, bounds, source, rowNum, arg.BackBrush, arg.ForeBrush, alignToRight)

End Sub

Protected Overloads Overrides Sub Edit( _
ByVal source As System.Windows.Forms.CurrencyManager, _
ByVal rowNum As Integer, _
ByVal bounds As System.Drawing.Rectangle, _
ByVal [readOnly] As Boolean, _
ByVal instantText As String, _
ByVal cellIsVisible As Boolean)

' Local variables.
Dim editBoxIsToBeHidden As Boolean = False
Dim e As New EditingCellEventArgs(rowNum, _columnNum, editBoxIsToBeHidden)

' Retrieve edit instructions.
RaiseEvent EditingCell(Me, e)

' Allow the call to progress normally.

MyBase.Edit( _
source, _
rowNum, _
bounds, _
[readOnly], _
instantText, _
cellIsVisible)

' Hide the edit box.
If e.EditBoxIsToBeHidden Then
Me.HideEditBox()
End If

End Sub

End Class
AnswerRe: VB.NET : Datagrid's scrolling giving error after selecting row Pin
Dave Kreskowiak8-Jun-12 10:07
mveDave Kreskowiak8-Jun-12 10:07 
QuestionHow do you right align using .ToString() Pin
David Mujica7-Jun-12 9:24
David Mujica7-Jun-12 9:24 
AnswerRe: How do you right align using .ToString() Pin
Luc Pattyn7-Jun-12 9:41
sitebuilderLuc Pattyn7-Jun-12 9:41 
GeneralRe: How do you right align using .ToString() Pin
David Mujica7-Jun-12 10:07
David Mujica7-Jun-12 10:07 
AnswerRe: How do you right align using .ToString() Pin
Alan N7-Jun-12 9:53
Alan N7-Jun-12 9:53 
GeneralRe: How do you right align using .ToString() Pin
MicroVirus8-Jun-12 10:47
MicroVirus8-Jun-12 10:47 
AnswerRe: How do you right align using .ToString() Pin
908236518-Jun-12 6:41
908236518-Jun-12 6:41 
QuestionDocument Viewer Pin
D. Joe6-Jun-12 16:30
D. Joe6-Jun-12 16:30 
AnswerRe: Document Viewer Pin
Dave Kreskowiak7-Jun-12 4:49
mveDave Kreskowiak7-Jun-12 4:49 
Questionfile not found: cs2.exe Pin
rizaky20115-Jun-12 19:12
rizaky20115-Jun-12 19:12 
AnswerRe: file not found: cs2.exe Pin
Richard MacCutchan5-Jun-12 21:13
mveRichard MacCutchan5-Jun-12 21:13 
GeneralRe: file not found: cs2.exe Pin
rizaky20117-Jun-12 16:54
rizaky20117-Jun-12 16:54 
GeneralRe: file not found: cs2.exe Pin
Richard MacCutchan7-Jun-12 21:44
mveRichard MacCutchan7-Jun-12 21:44 
GeneralRe: file not found: cs2.exe Pin
rizaky20118-Jun-12 18:26
rizaky20118-Jun-12 18:26 
QuestionDisabling external data connections when opening Excel. Pin
Aaron.Morrison5-Jun-12 14:27
Aaron.Morrison5-Jun-12 14:27 
AnswerRe: Disabling external data connections when opening Excel. Pin
Aaron.Morrison6-Jun-12 13:16
Aaron.Morrison6-Jun-12 13:16 
QuestionUse foreign key constraint with a loop ? Pin
Johan Hakkesteegt5-Jun-12 3:21
Johan Hakkesteegt5-Jun-12 3:21 

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.