I am using VB2017 and have data returned from Stored Procedure and I have filled a DataTable with data. The data in Datatable sample is
Date Bill Fred Jack
Date1 25 115 33
Date2 88 15 24
Date3 41 31 162
I have set UltraChart datasource to the datatable and then Bind data
Dim datTab As New DataTable
Using da As New SqlDataAdapter(cmd)
da.Fill(datTab)
End Using
ugResolved.Data.SwapRowsAndColumns = True
ugResolved.Data.DataSource = datTab
ugResolved.Data.DataBind()
When I run The chart isn't displayed. Get Box with the following text in it. Data Not Available. Please call Ultrachart.Data.DataBind() after setting valid Data.DataSource.
I have set the dataSource. What I am missing. Just starting using these controls. I have gotten the UltraGrid and UltraChart StackColumnChart working. Can anyone advise what I am missing.
I posted to Infragistics forums but still waiting couple of days later.
I would like a line for each name with line going from day to using the numbers as their path for each date
Related
I have 3 compobboxes I have created an import code from a SQL table
The problem when I choose a value from the first compbox
the values of other compbox is changed to be like my choice
I made a separate code for each compbox
But I find it impractical because my project has 90 compoboxes
It needs time to run
Is there a more practical solution?
this is my code...
Dim com As New SqlCommand("select Distinct Name1 from TB_dr", Con)
Dim RD As SqlDataReader = com.ExecuteReader
Dim DT As DataTable = New DataTable
DT.Load(RD)
ComboBox1.DisplayMember = "Name1"
ComboBox1.DataSource = DT
ComboBox2.DisplayMember = "Name1"
ComboBox2.DataSource = DT
ComboBox3.DisplayMember = "Name1"
ComboBox3.DataSource = DT
Only populate a combobox on its dropdown event.
That will make your app faster cause your client may not use them all and if he uses one combobox he would populate a small amount of data only.
And no data is populated on load.
As i look at what you are trying to do which is same data for all comboboxes, you can simply put all your comboboxes in a group, and go through your group to populate them all at once.
like for each cb in that group, cb.datasource = dt.
call the datatable once
I had this select query where textbox value is my parameter.
The case is, when I type text in the textbox it will be the reference for my select query. For example below,
Suppose my textbox has already a content;
123 32 5
And then i will add some text for my select query
123 32 5 66
The return value will be "66". And if i add another text
123 32 55 66 6952
The return value will be "6952". And So on, regardless of the length of the text
My idea here is that I start selecting the values from the first space to the right of the textbox. But I have no idea on how to do it.
Please help. Thanks
Here's an answer to your question. Now if you have a question related to your code then you should post some code to go with it showing you have done a bit of work. I'll give you a hint. Strings.Split()
This gives the same result....the last item in your split
Dim xx As String = "438 2374 8437 46327"
Dim xstr As String = xx.Split(" ").Last
Dim xxstr() As String = xx.Split(" ")
MsgBox(xstr)
MsgBox(xxstr(xxstr.Count - 1))
Play with strings!
I have a data table which has few rows and columns. I need to delete the entire data along with column names also.
Eg :
Item | 2017 | 2018 | 2019 | 2020
----------------------------------
A 400 200 300 500
B 400 300 500 100
C 100 200 500 300
D 100 300 400 100
I need to delete all the data of the above data table along with the column names so that I can re-use the same data table for storing other values.
I tried datatable.clear() method it is clearing only the data, the column names remain intact and also I can't use dispose().
How can I do it.?
Short version here:
Dim dt As New DataTable
'...
'you do some operations
'...
dt = New DataTable 'renew the same instance
Alternatively, you can use:
dt = Nothing 'basically setting it to NULL
This should work:
datatable.Clear() 'clear records
datatable.Constraints.Clear() 'clear constraints (required before Columns.Clear(), if there is any constraint)
datatable.Columns.Clear() 'clear columns
Or this:
datatable.Reset()
But if you want to just create a new "blank" instance, or in other words, reinitialize it:
datatable = New Datatable
The solution that work for me is the following
datatable.Reset()
Essentially this includes 3 components.
First is a form, here the user, via a listbox, chooses multiple names.
For example, they highlight the following names.
Jane
John
Bob
They click a button called "btnGenerate" and these three names get entered as seperate records into a table called "NameCriteria" like this:
ID Name
1 Jane
2 John
3 Bob
Along with this, on-click of the button btnGenerate, a report is generated.
What I cannot seem to get working is that on the report, I hope to get a summary of what was selected on the form. I have a textbox on this report which I am trying to get to generate the following result
Jane, John, Bob
OR if there is only one name highlighted when the btnGenerate is clicked, the textbox will only display
Jane
I cannot seem to get this working. In the report, on the textbox, under the textbox's data/control source, I have entered the following code.
=[Forms]![Report]![lstName]
This just leaves the textbox blank. I have also tried referencing the table "NameCriteria" using
=[Table]![NameCriteria]![Name]
and I return #Error in the textbox.
I'd use something along these lines, using ADO, but its been a long day, so there may be simpler solution.
Public Function CONCAT_SQL(strSQL As String) As String
Dim r As ADODB.Recordset
Dim a As Variant
Set r = New ADODB.Recordset
r.Open strSQL, CurrentProject.Connection, 1
a = Split(r.GetString, Chr(13))
ReDim Preserve a(UBound(a) - 1)
CONCAT_SQL = Join(a, ",")
End Function
Called like so,
me.textbox1.value = CONCAT_SQL("Select [Name] from [NameCriteria]")
Everyone,
I have been working on a program to manage our home finances. This is a program I am writing to further my knowledge of VB.NET. So far everything is going great but I am stuck at one point. I have a tabbed view setup in my main form. The tabs are Bills, Income and Summary. I am on the last tab (summary). Right now I have the bills written to a text file and the following items are separated by a |. The items placed in the file are:
Paid To | Date | Amount | Paid By | Confirmation Number | Notes
I have a ListView setup on my summary tab. The first column is to list the bills that we pay. The rest of the columns are months with a final total at the end (not worried about those yet). What I am having trouble with is searching through the text file for current year only records and listing out the Pay To in the first column of the ListView.
Here is the code that runs in the function. I calls a second function to fill the ListView column.
Try
sr = New StreamReader(MainBillsFile, True)
Dim ListBills As New List(Of String)
While (sr.Peek() > -1)
BillitmsSum = sr.ReadLine().Split("|")
Dim dateValue As Date = Date.Parse(BillitmsSum(1))
Dim DateYear As String = dateValue.Year
If DateYear = CurrentYear Then
BillitmPayTo = BillitmsSum(0)
End If
Output_On_Launch_BillSum()
End While
sr.Close()
sr.Dispose()
Catch ex As Exception
MessageBox.Show("Error Reading From File." & ex.Message)
End Try
When this runs when the program is loaded is the following.
Lets say I have 4 items in the file 2 with 2015 dates and 2 with 2014 dates. Based on what I want to show (current year 2015) I get the following
2015 item 1
2015 item 2
2015 item 2
2015 item 2
What I think is happening is the code is seeing all the items (4 total) and pulling the 2015 ones as it should but to fill up everything is is duplicating the last item to match the total items in the file of 4.
I hope this all makes sense. This is my first post here, up to this point searching has helped me greatly but I have tried a bunch of different code and they all give the same out come.
Here is the other Method:
Sub Output_On_Launch_BillSum()
Dim LVItem3 As ListViewItem = LVBillSum.Items.Add(BillitmPayTo)
End Sub
At first glance it appears you need to call Output_On_Launch_BillSum() only if the year of the bill is the current date. I'd need to see that method to be sure though.
If DateYear = CurrentYear Then
BillitmPayTo = BillitmsSum(0)
Output_On_Launch_BillSum()
End If