|
Create an event in your UserControl to signal that any subscriber that the selection in your control changed. The parent form should subscribe to this event so it can get notified when to reload the ListView control with new data.
Google for "VB.NET create an event[^]".
|
|
|
|
|
Hello everyone, I just want to ask for guide to where I'm doing wrong to my codes. My codes is basically to produce reports dynamically after results from database. I'm using vbnet 2015.
Sub Fill()
cryRpt.Load("C:\Users\MicroboxMac\Documents\Visual Studio 2015\Projects\ReportsDemo\ReportsDemo\bin\Debug\cr1.rpt")
cryRpt.SetDataSource(reportsQuery(TextBox1.Text.Trim))
CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
End Sub
This the table I'm getting the data results
Public Function reportsQuery(ByVal bId As Integer)
Dim db = New database
Dim dt As New DataTable
MessageBox.Show(bId)
With db
.sqlStr = "SELECT * from brandnames Where brandid = '" & bId & "' " 'query string
.sqlDa.SelectCommand = .sqlcm(.sqlStr, .connect) 'execute command
.sqlDa.Fill(.sqlDt) 'get results and store in sqldt
.close()
End With
Return db.sqlDt
End Function
unfortunately I'm stuck with this error...
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
Additional information: Could not load file or assembly 'file:///C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified.
I appreciate the time for helping out.
I got it working now...find the solution from other thread by Joezer BH
Best regards,
Joe
modified 18-Dec-16 22:15pm.
|
|
|
|
|
Hi,
I'm Using Visual Studio 2010 (.net) & Crystal Report 8.5 as Crystal Report Builder. I have a trouble that i can't view two different report in one view and different page.
can u help me ?
Thx
Hermawan
|
|
|
|
|
Can you just generate two reports, then add them as two views in a view group? Or paginate that using a control that supports such.
What framework are you using, ASP.NET, or what?
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
i'm using Vb.net
can you show me the code to views in a view group ?
modified 16-Dec-16 22:47pm.
|
|
|
|
|
Ever since .net came around we have not been able to create an exe, or assembly that did not need the .net framework. Now with containers and smaller computing spaces available in .net it would be nice to have an optimized exe or service compiled to native code. Can this be done with Visual Studio or does ability belong to another compiler and no longer in Microsoft's abilities?
I would like this to be done with the Microsoft, but if not I will need to search for another professional Basic that can do the job.
|
|
|
|
|
|
Almost. Seems this only works with Universal Windows Apps. No services, command prompt apps, OS event handlers etc. Microsoft is so close, but their insistence on WMA is a road block.
|
|
|
|
|
There is no other product that does this.
There used to be another product quite a while ago, I think it was called something like "Salamander", but it cost about $2,000 and only worked with .NET 2.0 and below.
As for another BASIC product, good luck with that. You're not going to find one that's any good.
|
|
|
|
|
rkinning wrote: if not I will need to search for another professional Basic that can do the job Good luck with that
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
This one[^] might fit the bill.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I can pop a 128GB file-based micro-card into my mp3 player.
What's the problem?
|
|
|
|
|
This is that FoxPro project that I'm working on, and creating a sub report for a report; while using the event handler for SubReportProcessing.
So I have this dataset that I pass to the RDLC file which is a list of invoices for the month. Each invoice has items that I'm using a sub report for. So I made an event handler for it. I have the data already, and perhaps it would be easier to just write another function to load the data in the event handler instead.
But I just can't get this last part in my event handler, it's so foreign to me.
This is the dataset below that has my invoice items, that I add to LocalReport and is passed to the RDLC. so I have a dataset that is ready to go in "ds_invoice_items"
Dim ds_items As New DataSet()
ds_items.DataSetName = "ds_invoice_items"
ds_items.Tables.Clear()
ds_items.Tables.Add(table_Items)
ds_items.Tables(0).TableName = "tablix_invoice_items"
'Write the datasource to the report canvas
rv_Canvas.LocalReport.DataSources.Clear()
rv_Canvas.LocalReport.DataSources.Add(New ReportDataSource("ds_salesRep", ds_salesRep.Tables(0)))
rv_Canvas.LocalReport.DataSources.Add(New ReportDataSource("ds_salesRep_invoices", ds_invoices.Tables(0)))
rv_Canvas.LocalReport.DataSources.Add(New ReportDataSource("ds_invoice_bAddress", ds_bAddress.Tables(0)))
rv_Canvas.LocalReport.DataSources.Add(New ReportDataSource("ds_invoice_sAddress", ds_sAddress.Tables(0)))
rv_Canvas.LocalReport.DataSources.Add(New ReportDataSource("ds_invoice_items", ds_items.Tables(0)))
rv_Canvas.LocalReport.DisplayName = p_salesRepName & " Invoices"
AddHandler rv_Canvas.LocalReport.SubreportProcessing, AddressOf Me.SetSubDataSource
This is my event handler. The first and 2nd line works. It's the 3rrd line.
My Question is:
I know List(Of model_invoice_items) is wrong. I can't figure out what to replace it with.
Do I get the type, or hard code the type, I don't even know what the type is.
Private Sub SetSubDataSource(ByVal sender As Object, ByVal e As SubreportProcessingEventArgs)
<pre>
Dim mainSource = CType(sender, LocalReport).DataSources("ds_invoice_items")
Dim FINVNO = Integer.Parse(e.Parameters("FINVNO").Values.First)
Dim subSource = CType(mainSource.Value, List(Of model_invoice_items)).Single(Function(m) m.FINVNO = FINVNO)
e.DataSources.Add(New ReportDataSource("ds_invoice_items", subSource))
End Sub
21st Century Globalism has become Socialism on a planetary scale, in which the unequal treaties of the past have come back into play.
|
|
|
|
|
jkirkerx wrote: New ReportDataSource("ds_invoice_items", ds_items.Tables(0))
You're creating the ReportDataSource by passing in a DataTable . Therefore, I would expect the mainSource.Value property to return a DataTable .
Private Sub SetSubDataSource(ByVal sender As Object, ByVal e As SubreportProcessingEventArgs)
Dim FINVNO As Integer = Integer.Parse(e.Parameters("FINVNO").Values.First)
Dim mainSource As ReportDataSource = DirectCast(sender, LocalReport).DataSources("ds_invoice_items")
Dim mainTable As DataTable = DirectCast(mainSource.Value, DataTable)
Dim subSource As New DataView(mainTable)
subSource.RowFilter = String.Format("FINVNO = {0:D}", FINVNO)
e.DataSources.Add(New ReportDataSource("ds_invoice_items", subSource))
End Sub
If that doesn't work, then you'll need to debug your code; Visual Studio should be able to show you the correct type of the mainSource.Value property.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
It runs without error and produces results, I just need to validate the results
Question:
subSource.RowFilter = String.Format("FINVNO = {0 }", FINVNO)
The
{0:d} , the value is just a string of numbers, should I change that?
I Actually started thinking a dataview, but ended up with a rats nest, not clean like yours.
Dim FINVNO = Integer.Parse(e.Parameters("FINVNO").Values.First)
Dim ds_invoiceItems As ReportDataSource = CType(sender, LocalReport).DataSources("ds_invoice_items")
Dim dt_invoiceItems As DataTable = ds_invoiceItems.Value
Dim dv_invoiceItems As New DataView(dt_invoiceItems)
Dim view_items = dv_invoiceItems.ToTable().Rows.Cast(Of DataRow)()
Dim table_items As DataTable = view_items.Where(Function(row) row.Field(Of String)("FINVNO") = FINVNO).CopyToDataTable()
Dim ds_items As New DataSet()
ds_items.DataSetName = "ds_invoice_items"
ds_items.Tables.Clear()
ds_items.Tables.Add(table_Items)
ds_items.Tables(0).TableName = "tablix_invoice_items"
e.DataSources.Add(New ReportDataSource("ds_invoice_items", ds_items.Tables(0)))
21st Century Globalism has become Socialism on a planetary scale, in which the unequal treaties of the past have come back into play.
|
|
|
|
|
Since the FINVNO variable is an Integer , I assumed the FINVNO column would be as well.
The D is just a standard numeric format string: The Decimal ("D") Format Specifier[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hello,
so, i am a newbie, and i have this code for my .INI settings:
Module Module1
Public Class IniFile
Private Declare Ansi Function GetPrivateProfileString Lib "kernel32.dll" Alias "GetPrivateProfileStringA" _
(ByVal lpApplicationName As String,
ByVal lpKeyName As String,
ByVal lpDefault As String,
ByVal lpReturnedString As System.Text.StringBuilder,
ByVal nSize As Integer,
ByVal lpFileName As String) _
As Integer
Private Declare Ansi Function WritePrivateProfileString Lib "kernel32.dll" Alias "WritePrivateProfileStringA" _
(ByVal lpApplicationName As String,
ByVal lpKeyName As String,
ByVal lpString As String,
ByVal lpFileName As String) _
As Integer
Public Property Path As String
Public Sub New(ByVal IniPath As String)
_Path = IniPath
End Sub
Public Function ReadValue(ByVal section As String, ByVal key As String) As String
Dim sb As New System.Text.StringBuilder(255)
Dim i = GetPrivateProfileString(section, key, "", sb, 255, Path)
Return sb.ToString()
End Function
Public Sub WriteValue(ByVal section As String, ByVal key As String, ByVal value As String)
WritePrivateProfileString(section, key, value, Path)
End Sub
End Class
End Module
.. but this does not allows me to read multiline... it is writing multiline in the .INI file, but it is not reading!!
What do i need to change or do to read multiline of the .INI file?
TIA,
Duarte
modified 7-Jan-19 21:02pm.
|
|
|
|
|
Can you show the response that it read, vs. the input that was given? I think you are reading entire content as text (instead of lines).
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Afzaal Ahmad Zeeshan wrote: Can you show the response that it read, vs. the input that was given?
Well, i am inserting text like this in a multiline textbox:
test now
multiline etc...
And it is returning on read only the first line, in this case only the "test now" words!
modified 7-Jan-19 21:02pm.
|
|
|
|
|
INI file elements are expected to each be on a single line. If you have large amounts of data then you need to think of an alternative method of storing it. Also these functions have been deprecated in favour of using the Registry.
|
|
|
|
|
ok... so what do you advise for storing text?!!
I am very newbie but i understand some snippets!!
Thanks!
modified 7-Jan-19 21:02pm.
|
|
|
|
|
The first thing you need to answer is: what is this information used for, and how long do you need to store it? If it is just simple text that your program needs to process then use a text file or similar. INI files are really just for static key/value pairs that do not change often.
|
|
|
|
|
Yes i understand... i am currently trying a piece of code from MSDN to write a reaad from .txt!
Thanks : )
Duarte
modified 7-Jan-19 21:02pm.
|
|
|
|
|
Hi,
sorry to bother again but i need a bit more help!!!
Now i have this code to write and read from .txt files:
Sub readtext()
Dim path As String = Directory.GetCurrentDirectory()
Dim fileReader As String
fileReader = My.Computer.FileSystem.ReadAllText(path + Form1.TextBox1.Text + ".txt")
Form1.TextBox2.Text = fileReader
End Sub
Sub writetext()
Dim objStreamWriter As StreamWriter
Dim path As String = Directory.GetCurrentDirectory()
objStreamWriter = New StreamWriter(path + Form1.TextBox1.Text + ".txt")
objStreamWriter.WriteLine(Form2.TextBox2.Text)
objStreamWriter.Close()
End Sub
... but when it tries to read from an unexisting file, it returns a code error.... my question is what can i do so that when i press a button that applies te "readtext" function, but the file does not exists, it shows a msgbox instead of returnning code error?
I hope i s clear enough!!!??
Thanks,
Duarte
modified 7-Jan-19 21:02pm.
|
|
|
|
|
Try something like this:
Sub readtext()
Dim folderPath As String = Directory.GetCurrentDirectory()
Dim filePath As String = Path.Combine(folderPath, Form1.TextBox1.Text + ".txt")
If Not File.Exists(filePath) Then
MessageBox.Show("File not found.")
Return
End If
Try
Dim fileContents As String = File.ReadAllText(filePath)
Form1.TextBox2.Text = fileContents
Catch ex As FileNotFoundException
MessageBox.Show("File was deleted")
Catch ex As IOException
MessageBox.Show(ex.Message)
End Try
End Sub
Sub writetext()
Dim folderPath As String = Directory.GetCurrentDirectory()
Dim filePath As String = Path.Combine(folderPath, Form1.TextBox1.Text + ".txt")
Using writer As StreamWriter = File.AppendText(filePath)
writer.WriteLine(Form2.TextBox2.Text)
End Using
End Sub
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|