Click here to Skip to main content
15,890,557 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Visual Basicc Code Pin
JR2121-Dec-14 19:25
JR2121-Dec-14 19:25 
AnswerRe: Visual Basicc Code Pin
Richard MacCutchan1-Dec-14 22:17
mveRichard MacCutchan1-Dec-14 22:17 
Questionvb project help Pin
Member 1126438330-Nov-14 12:36
Member 1126438330-Nov-14 12:36 
AnswerRe: vb project help Pin
Dave Kreskowiak30-Nov-14 13:25
mveDave Kreskowiak30-Nov-14 13:25 
QuestionEvents Pin
jkirkerx30-Nov-14 9:35
professionaljkirkerx30-Nov-14 9:35 
QuestionHelp for code in vb.net Pin
Member 1127214729-Nov-14 16:21
Member 1127214729-Nov-14 16:21 
SuggestionRe: Help for code in vb.net Pin
Richard MacCutchan29-Nov-14 23:26
mveRichard MacCutchan29-Nov-14 23:26 
Questionwordwrap on datagridtextboxcolumn Pin
Member 1126800728-Nov-14 16:39
Member 1126800728-Nov-14 16:39 
Hi have looked at previous answers on this blog which dont seem to help me.

I have a datagrid and add columns that are datagridtextboxcolumn . When I click on a cell on datagrid - if the line is too big for the width of cell , it will display on the following line, but when I am not clicked on the cell, the end of the line of text will not be displayed on the next line - and is therefore not displayed.


I derived a new class from datagridtextboxcolumn and attempted to override the paint and painttext methods and this appeared to have no effect - the text is displayed in the column and only 1 line is displayed.


My code is


Here is the derived class: -

( below I have overridden the paint and painttext class in order to see which method has some effect on the display in the datagrid - but there is no effect occuring through this process of overriding.

Imports Microsoft.VisualBasic
Imports System.ComponentModel
Imports System.Data
Imports System.Data.Common
Imports System.Data.OleDb
Imports System.Drawing
Imports System.Windows.Forms
Namespace DataGridRichTextBox


    Public Class DataGridRichTextBoxColumn
        Inherits DataGridTextBoxColumn

        Private _source As CurrencyManager
        Private _rowNum As Integer
        Private _isEditing As Boolean



        Public Sub New()
            _source = Nothing
            _isEditing = False
        End Sub 'New



        Protected Overloads Sub PaintText(ByRef g As Graphics, ByVal bounds As System.Drawing.Rectangle, ByRef Text As String, ByVal alligntoright As Boolean)

        End Sub

        Protected Overloads Sub PaintText(ByRef g As Graphics, ByVal bounds As System.Drawing.Rectangle, ByRef Text As String, ByRef s1 As System.Drawing.Brush, ByRef s2 As System.Drawing.Brush, ByVal alligntoright As Boolean)
        End Sub

        Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal bounds As System.Drawing.Rectangle, ByVal _source As CurrencyManager, ByVal num As Integer)
        End Sub

        Protected Overloads Overrides Sub SetColumnValueatrow(ByVal _source As CurrencyManager, ByVal num As Integer, ByVal obj As Object)
        End Sub

    End Class 'DataGridComboBoxColumn
End Namespace







Here is where I add the derived class as an object to the datagrid : - 



Imports System.Windows.Forms
Imports System.Data.SqlClient
Imports System.Drawing




Public Class DataGridMine
    Inherits DataGrid



    Public r_counter, column_num, x1 As Integer

    Public x13 As Integer

#Region " Windows Form Designer generated code "


    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

    End Sub
    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub
    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer
    Friend WithEvents SqlSelectCommand2 As New SqlCommand
    Friend WithEvents DataSet51 As New tasks_trial2.DataSet5
    Public WithEvents DataGridTableStyle1 As New DataGridTableStyle



    Public WithEvents task_name_col, parent_col As New DataGridTextBoxColumn


    Public WithEvents description_col As New DataGridRichTextBox.DataGridRichTextBoxColumn



    Friend WithEvents SqlDataAdapter3 As New SqlDataAdapter

    Friend WithEvents SqlDataAdapter2 As New SqlDataAdapter
    Friend WithEvents SqlSelectCommand3 As New SqlCommand




    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
        CType(Priority_code_table1, System.ComponentModel.ISupportInitialize).BeginInit()



        SuspendLayout()



        Me.DataMember = "tasks"
        Me.DataSource = DataSet51
        Me.Location = New Point(8, 230)
        Me.Size = New Size(1117, 384)
        Me.TabIndex = 0


        Me.TableStyles.AddRange(New DataGridTableStyle() {DataGridTableStyle1})


  

        SqlDataAdapter2.SelectCommand = SqlSelectCommand2
        SqlDataAdapter2.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "tasks")})

        SqlSelectCommand2.CommandText = ""
        SqlSelectCommand2.Connection = SqlConnection10


        DataGridTableStyle1.DataGrid = Me



        DataGridTableStyle1.AllowSorting = False

        column_num = 3

        DataGridTableStyle1.HeaderForeColor = SystemColors.ControlText
        DataGridTableStyle1.MappingName = "tasks"
        DataGridTableStyle1.SelectionBackColor = Color.Aquamarine
        DataGridTableStyle1.SelectionForeColor = Color.Black
        DataGridTableStyle1.PreferredRowHeight = 10
        DataGridTableStyle1.PreferredColumnWidth = 75



        description_col.HeaderText = "Description"
        description_col.MappingName = "description"
        description_col.Width = 260



.....................


' where column is description_col.

  Public Sub add_columns(ByRef dgrid1 As DataGridMine, ByVal column As Object)

        dgrid1.DataGridTableStyle1.GridColumnStyles.AddRange(New DataGridColumnStyle() {column})

    End Sub

QuestionHow can I convert the VBA OCT() function in to a VB .NET function Pin
Stephen Holdorf28-Nov-14 5:17
Stephen Holdorf28-Nov-14 5:17 
AnswerRe: How can I convert the VBA OCT() function in to a VB .NET function Pin
Richard MacCutchan28-Nov-14 5:56
mveRichard MacCutchan28-Nov-14 5:56 
AnswerRe: How can I convert the VBA OCT() function in to a VB .NET function Pin
Richard Deeming28-Nov-14 8:12
mveRichard Deeming28-Nov-14 8:12 
Questiondrawline Pin
JR21227-Nov-14 20:29
JR21227-Nov-14 20:29 
AnswerRe: drawline Pin
Eddy Vluggen28-Nov-14 7:55
professionalEddy Vluggen28-Nov-14 7:55 
GeneralRe: drawline Pin
JR21228-Nov-14 18:11
JR21228-Nov-14 18:11 
GeneralRe: drawline Pin
Eddy Vluggen30-Nov-14 4:44
professionalEddy Vluggen30-Nov-14 4:44 
GeneralRe: drawline Pin
JR2122-Dec-14 20:45
JR2122-Dec-14 20:45 
QuestionApplication Software with Online Database Pin
akashangel26-Nov-14 18:39
akashangel26-Nov-14 18:39 
AnswerRe: Application Software with Online Database Pin
Richard MacCutchan26-Nov-14 20:40
mveRichard MacCutchan26-Nov-14 20:40 
AnswerRe: Application Software with Online Database Pin
Bernhard Hiller27-Nov-14 0:36
Bernhard Hiller27-Nov-14 0:36 
QuestionDeserialize Json and store values Pin
jkirkerx26-Nov-14 6:56
professionaljkirkerx26-Nov-14 6:56 
AnswerRe: Deserialize Json and store values Pin
Eddy Vluggen26-Nov-14 8:09
professionalEddy Vluggen26-Nov-14 8:09 
GeneralRe: Deserialize Json and store values Pin
jkirkerx26-Nov-14 8:44
professionaljkirkerx26-Nov-14 8:44 
AnswerRe: Deserialize Json and store values Pin
Richard Deeming26-Nov-14 8:20
mveRichard Deeming26-Nov-14 8:20 
GeneralRe: Deserialize Json and store values [Solved] Pin
jkirkerx26-Nov-14 8:43
professionaljkirkerx26-Nov-14 8:43 
QuestionDrag drop multiple rows between datagrids Pin
tommydk26-Nov-14 1:09
tommydk26-Nov-14 1:09 

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.