我对工作中的一个项目有需求方面的问题。我正在做的是创建带有DataGridView数据表的制造计划。通过DataGridView我获得了活动和日期(开始和结束),在获得的值内,创建了活动的主要主题(这些活动在DataGridView中没有日期),我需要以粗体突出显示,因为它是任务的负责人。我尝试了几种选择,但都无济于事。当我尝试这些选项时,我遇到了一个错误,因为在开始时DataGridView不会显示数据,任务是根据用户的需求进行计算的,因此我无法放置单元格的坐标。
主要主题:工程,材料,支撑腿,内部配件,喷嘴,通道等。 Main topics(picture related)
我希望在相关图片中,带有蓝色箭头的任务具有粗体格式
代码如下:
Dim Table As New DataTable
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Table.Columns.Add("Operación", Type.GetType("System.String"))
Table.Columns.Add("Fecha Inicial", Type.GetType("System.DateTime"))
Table.Columns.Add("Fecha Final", Type.GetType("System.DateTime"))
DataGridView1.DataSource = Table
For C As Integer = 0 To DataGridView1.Columns.Count - 1
DataGridView1.Columns(C).HeaderCell.Style.Font = New Font("Microsoft Sans Serif", 10, FontStyle.Bold)
DataGridView1.Columns(C).AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells
Next C
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim date1 As Date
Try ' En el caso de error en TextBox1
date1 = CType(TextBox1.Text, Date)
Catch
Exit Sub
End Try
Dim numRows As Integer
Dim DateBegin As Date
Dim DateEnd As Date
Dim Duration As Integer
'----------------CHANNEL
Table.Rows.Add("CHANNEL")
If Integer.TryParse(TextBox4.Text, numRows) Then
If (numRows >= 1) Then
For i As Integer = 1 To numRows
Duration = 1 ' Duración de esta actividad
DateBegin = NoWeekEnd(date1) ' El mismo dia de inicio ' Comienza este trabajo
DateEnd = NoWeekEnd(DateBegin.AddDays(Duration))
Table.Rows.Add("TRACE AND CUT PLATE C" & i, DateBegin, DateEnd)
Next
End If
'----------------ENGINEERING
Table.Rows.Add("ENGINEERING")
Duration = TextBox2.Text
DateBegin = NoWeekEnd(date1)
DateEnd = NoWeekEnd(DateBegin.AddDays(Duration))
Table.Rows.Add("SENDING DRAWINGS FOR APPROVAL", DateBegin, DateEnd)
date1 = DateEnd
End Sub