Click here to Skip to main content
15,886,110 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionCall a method inside a Task.Run and return the value Pin
Mc_Topaz2-Dec-20 3:03
Mc_Topaz2-Dec-20 3:03 
AnswerRe: Call a method inside a Task.Run and return the value Pin
Richard MacCutchan2-Dec-20 3:23
mveRichard MacCutchan2-Dec-20 3:23 
AnswerRe: Call a method inside a Task.Run and return the value Pin
Gerry Schmitz2-Dec-20 5:23
mveGerry Schmitz2-Dec-20 5:23 
Questionvb.net addin won't run in release mode Pin
JR21230-Nov-20 23:53
JR21230-Nov-20 23:53 
AnswerRe: vb.net addin won't run in release mode Pin
BabyYoda1-Dec-20 5:53
BabyYoda1-Dec-20 5:53 
GeneralRe: vb.net addin won't run in release mode Pin
JR2121-Dec-20 6:22
JR2121-Dec-20 6:22 
QuestionRe: vb.net addin won't run in release mode Pin
Richard MacCutchan1-Dec-20 6:36
mveRichard MacCutchan1-Dec-20 6:36 
QuestionCreate Multi Series Chart in VB.net Pin
Member 1500024122-Nov-20 21:46
Member 1500024122-Nov-20 21:46 
Hello,

I would like to make a multi Series chart in vb.net how many of series depends on the department and the data gathered from a data-table which is collected from a DataGridView.

The table is shown as follow:
Department Period_Shown Rate_Int
EMW 2018 0.94
EMW 2019 0.55
ACH 2015 0.29
ACH 2016 0.52
ACH 2017 0.56
ACH 2018 0.63
ACH 2019 0.57

It have error on my code and it made the server freeze. Here is the warning message: Using the iteration variable in a query expression may have unexpected result. Instead create a local variable within the loop and assign it value of the iteration variable.Here is the source code for the chart control. Can anyone help me to fix it?

VB
    Dim dtRate As New DataTable("dtRate")
    'Add columns to DataTable.
    For Each cell As TableCell In GridView1.HeaderRow.Cells
        dtRate.Columns.Add(cell.Text)
    Next
    'Loop through the GridView and copy rows.
    For Each row As GridViewRow In GridView1.Rows
        dtRate.Rows.Add()
        For i As Integer = 0 To row.Cells.Count - 1
            dtRate.Rows(row.RowIndex)(i) = row.Cells(i).Text
        Next
    Next
    Dim Departments As List(Of String) = (From p In dtRate.AsEnumerable() _
                                   Select p.Field(Of String)("Department")).Distinct().ToList()
    If RateChart.Series.Count() = 1 Then
        RateChart.Series.Remove(RateChart.Series(0))
    End If
    'Loop through the Departments.
    For Each UserDepartment As String In Departments
        'Get the Shown_Period for each Department.
        Dim x As Integer() = (From p In dtRate.AsEnumerable() _
                              Where p.Field(Of String)("Department") = UserDepartment _
                              Order By p.Field(Of Integer)("Shown_Period") _
                              Select p.Field(Of Integer)("Shown_Period")).ToArray()
        'Get the Num_Int of Orders for each Department.
        Dim y As Integer() = (From p In dtRate.AsEnumerable() _
                              Where p.Field(Of String)("Department") = UserDepartment _
                              Order By p.Field(Of Integer)("Shown_Period") _
                              Select p.Field(Of Integer)("Num_Int")).ToArray()
        'Add Series to the Chart.
        RateChart.Series.Add(New Series(UserDepartment))
        RateChart.Series(UserDepartment).IsValueShownAsLabel = True
        RateChart.Series(UserDepartment).BorderWidth = 3
        RateChart.Series(UserDepartment).ChartType = SeriesChartType.Line
        RateChart.Series(UserDepartment).Points.DataBindXY(x, y)
    Next
    RateChart.Legends(0).Enabled = True
    RateChart.Visible = True
    btn_Print.Visible = True
End Sub</<pre lang="vb">
pre>
AnswerRe: Create Multi Series Chart in VB.net Pin
Richard Deeming22-Nov-20 22:22
mveRichard Deeming22-Nov-20 22:22 
Questionneed some guidance and advice to build a questionnaire system similar to Google forms in vb.net or c# and sql server Pin
albasheer210019-Nov-20 18:05
albasheer210019-Nov-20 18:05 
AnswerRe: need some guidance and advice to build a questionnaire system similar to Google forms in vb.net or c# and sql server Pin
Richard MacCutchan19-Nov-20 22:14
mveRichard MacCutchan19-Nov-20 22:14 
AnswerRe: need some guidance and advice to build a questionnaire system similar to Google forms in vb.net or c# and sql server Pin
CHill6020-Nov-20 1:59
mveCHill6020-Nov-20 1:59 
QuestionSend a file via a bot telegram vb.net Pin
Member 1496222414-Nov-20 11:33
Member 1496222414-Nov-20 11:33 
AnswerRe: Send a file via a bot telegram vb.net Pin
Dave Kreskowiak14-Nov-20 12:14
mveDave Kreskowiak14-Nov-20 12:14 
QuestionChanging the color of specific text and selecting visual basics word Pin
DaniOM9-Nov-20 1:25
DaniOM9-Nov-20 1:25 
AnswerRe: Changing the color of specific text and selecting visual basics word Pin
CHill6017-Nov-20 23:59
mveCHill6017-Nov-20 23:59 
QuestionProblem in sending sms Pin
Member 137109127-Nov-20 4:44
Member 137109127-Nov-20 4:44 
AnswerRe: Problem in sending sms Pin
Richard Andrew x647-Nov-20 8:46
professionalRichard Andrew x647-Nov-20 8:46 
QuestionProblem receiving hex value on serialport Pin
Member 102013576-Nov-20 3:23
Member 102013576-Nov-20 3:23 
QuestionDim objNewItem As ComboItem Pin
empalamado4-Nov-20 7:00
empalamado4-Nov-20 7:00 
AnswerRe: Dim objNewItem As ComboItem Pin
Victor Nijegorodov4-Nov-20 7:51
Victor Nijegorodov4-Nov-20 7:51 
AnswerRe: Dim objNewItem As ComboItem Pin
Dave Kreskowiak4-Nov-20 8:39
mveDave Kreskowiak4-Nov-20 8:39 
QuestionNaming added Controls Pin
Member 1495490329-Oct-20 12:00
Member 1495490329-Oct-20 12:00 
AnswerRe: Naming added Controls Pin
Gerry Schmitz29-Oct-20 13:44
mveGerry Schmitz29-Oct-20 13:44 
GeneralRe: Naming added Controls Pin
Member 1495490329-Oct-20 13:49
Member 1495490329-Oct-20 13:49 

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.