How to link webform through vb.net code parsing data. - vb.net

net and I am trying to create a project that will handle questions from a text file and save the answers to a new text file. I was searching the internet and I couldn't find an example for linking two webform through vb code so here is my problem:
I want to preprocess a text file that will be uploaded in a specific form through vb.net . That context is parsed in a string table. Now I want that table to pass over to the rest of my forms which they will handle the data in order to modify the below webform. Here is where I want to call the other forms in order.
Private Sub BtdContinue_Click(sender As Object, e As EventArgs) Handles BtdContinue.Click
If FileUpl.PostedFile IsNot Nothing Then
Dim finalTextTable(rows.Length, 4) As String
'Preprocess
'for i=0 to finalTextTable.Lenght-1
' for j=0 to 4
'Call the other web form from here in a loop if possible
End if
Here is my web form with labels and images that I want every question to change it
I also want to be able to go to the previous webform through a
previous button.

If i did understand your question correctly you are asking to redirect the data from the preprocessed text file to another form. The easiest solution i can think of is by using session variables. After you have preprocessed your text file and stored it into a dataTable you should add the following:
'Set the value of DataTable to session
Session("DataTb") = finalTextTable
'Perform your Redirect
Response.Redirect("FormB.aspx");
The above code should save the table into a session variable accessible by FormB.aspx. You can then handle the table in the second form as you wish.

Related

How can I redirect to the same page multiple times with a different query string?

I have a page that contains a table with a list of data and an icon (on each row) which redirects the user to a new aspx page with a queryString and does some custom logic to then download the file. The user has asked that we make a "download all" button so they don't have to go through and manually click every icon in every row.
My code is close, I feel, but it will hang after the first file is downloaded and will never progress further.
Here is the code I have so far
Protected Sub ibDownloadAll_Click(sender As Object, e As ImageClickEventArgs)
'Get Parameters
'Run stored procedure to get the query string we're going to use
'Fill DataSet
For Each myItem As DataRow In ds.Tables(0).Rows
Response.Redirect("redirectPage?ID=" &myItem.Item("ID")) 'Gets stuck after here
Next
End Sub
I realized if I added the second parameter (Indicates whether execution of the
current page should terminate)
Response.Redirect("redirectPage?ID=" &myItem.Item("ID"), False)
Then it would make it to the end of the function, running through the loop as expected, but then only outputting/downloading the last file.
Is there something I'm missing or an alternative that can be used to effectively redirect multiple times? Unfortunately with the framework I'm using I'm not able to use Response.Write and put custom scripts in that way, nor can I really change the page that we are redirecting to.
You can't redirect to multiple pages (a redirect close the request) and you also can't send multiple files. Your only option would be to have a request that zip all the files together. You can do this with System.IO.Compression.ZipArchive. You don't need to save the zip on disk, you could just send the memory stream.

Show file input when click button event on LotusScript?

I am working with Lotus Domino. When I read the xml file I want to click on a button and it displays a form to let me select the file:
Sub Click(Source As Button)
//How to file input form display here
End Sub
There's still one more problem.I read the xml file and output data is documents:
Dim reader As New XmlNodeReader
Call reader.ReadFile(datas)
documents = reader.getNodeReaders("egov.document ")
Forall document In documents
//How to display list document for my form
End Forall
Please help me in the shortest possible time.Thanks all!!!!
To display a dialog that allows you to select a file, use the Prompt method of the NotesUIWorkspace class.
The rest of your question requires knowledge of the particular XML schema you are working with.

RDLC report for multiple checked box items in Listview in vb.net

I need a little help here.
I have a form which shows all the clients, stored in the access database, as a check-box items in a listview control. I want a user to check multiple checkboxes to view details of the selected clients and show it in the rdlc report.
I have written the following codes in VB.net at form_load event, but it only shows the last selected item.
I want some seggustion for the codes which shows details in the rdlc report for all the selected clients.
Private Sub TodaysPendingCompliances_Load(sender As Object, e As EventArgs) Handles MyBase.Load
For Each SelctedCLient As ListViewItem In TodaysCompliances.ListView1.CheckedItems
Me.NoticeComplianceTableAdapter.FillByClientANDComplianceDate(Me.ComplianceDBDataSet.NoticeCompliance, SelctedCLient.Text)
Next
Me.ReportViewer1.RefreshReport()
End Sub
You help will be highly appreciated.
I beleive your problem is that NoticeComplianceTableAdapter.FillByClientANDComplianceDate overwrites the existing data with fresh data from the current iteration every time it is called, so it only holds the last iteration data.
To fix that you will either need to modify that function (or create an overload for it) to not clear the existing data, or create a temporary container that you declare before the loop, and add new data to each time, then attach the report to that temporary data.
Thank you Mr. Bradlet Uffner for you response. You reply helped in finding the solution.
The solution is to set the Clearbeforefill = False for the NoticeComplianceTableAdater
Setting Clearbeforefill to false does not clear the existing data with fresh data from the current iteration.

Updating a control on another form with the results of a dialog box

I made a windows form which contains a listbox (named VenueList). The listbox is pulling it's values from a list provided by a binding source VenuesBindingSource which is pulling in a ID for the value and a name for the text.
There is a button which is causing a DialogBox to appear which is asking for values to store in the database for a NEW venue. Once the values are filled and insert the database, what's supposed to happen is that the dialog box closes and goes back to the original form which invoked it.
However, instead of updating the list. The list stays the same. But if you close the form and reopen it, you see that a new value was added.
TournamentSettings.VenuesTableAdapter.InsertVenueQuery(Trim(VenueNameTxt.Text), Trim(VenueAddress1Txt.Text), Trim(VenueAddress2Txt.Text), Trim(VenueCityTxt.Text), Trim(VenueProvinceTxt.Text), Trim(VenueZipTxt.Text), Trim(CountryBox.SelectedValue), Trim(VenuePhoneNo.Text), VenueType.SelectedText, VenueWebAddress)
TournamentSettings.VenuesTableAdapter.Fill(TournamentSettings.VenueNameList.Venues)
In the above code, InsertVenueQuery is the name of a query from the designer which is invoked to add the values onto the tableadapter VenuesTableAdapter which is used to fill the combo box on load. I also sent the Fill command to refill the table with the new value.
So the question is, should I go about doing this another way, rather than feeding the Table adapter and sending a fill command on to the datatable? Or is there something that I'm not doing here which I should to force that value into the list. I'm tempted to redo everything outside of the designer but that's a lot of code since I have to essentially run two commands (one to insert the data, and another to get the ##IDENTITY value since this is run on an access database.)
Okay. This one I had to think about for a moment.
Instead of me creating a block of done on the load event, I instead created a sub function called "FillVenueList".
I used the following block of code:
Public Sub FillVenueList()
' Adding values from database to a datatable.
' From there will add to the list box.
Dim VenueConnection As New OleDb.OleDbConnection(DBconnection)
VenueConnection.Open()
Dim VenueConnectionQuery As New OleDb.OleDbCommand("SELECT VenueID, VenueName FROM Venues", VenueConnection)
Dim VenueDataAdapter As New OleDb.OleDbDataAdapter(VenueConnectionQuery)
Dim VenueDataSet As New DataSet
VenueDataAdapter.Fill(VenueDataSet, "Venues")
TrnVenueLst.DataSource = VenueDataSet.Tables("Venues")
TrnVenueLst.DisplayMember = "VenueName"
TrnVenueLst.ValueMember = "VenueID"
VenueConnection.Close()
End Sub
From there I called THIS sub on both the form AND the Add Venue window and I can safely see that this works. SO THAT is how you get a new value onto the form, don't use it as a part of the Load Event but rather call it from the load event block, then call it when you want to add to the list.

VB.NET / Windows Forms - Data from user input to DataReport?

I'm developing a windows forms application using VB.NET. I'm currently working on DataReport (by Microsoft, not Crystal). Everything works fine when using DataSet as DataSource. But I have a question on how am I going to put data to my DataReport from a user input? Preferably when the user is on the act of printing(clicking the print button in the ReportViewer), a Form will pop-up and ask him for input. That input I'm talking about is random names of people, and we don't have to track their names so there's no reason to put it on the database.
Here's my simple setup:
MainForm.vb (Form)
MyReportViewer (ReportViewer)
MyReport.rdlc (DataReport)
InputForm (Form)
MyInputBox (TextBox)
If it is impossible to do it on the act of printing. Maybe on the MainForm_Load event or before the generation of report can do.
I've searched the net for an hour but I'm out of luck.
I've found the answer, it's called ReportParameters.
Here's how to set it:
'Get input from user...
Dim OneParameter As String = InputBox("Enter something to display on report!", "Report Parameter")
'Prepare report parameters... The `SetParameters` requires array of `ReportParameter`...
Dim ReportParameters As New List(Of ReportParameter)
'Add the user input to `ReportParameter` array...
ReportParameters.Add(New ReportParameter("OneParameter", OneParameter, True))
'Set the `ReportParameters` of the `ReportViewer`...
FormWithReportViewer.TheReportViewer.LocalReport.SetParameters(ReportParameters)
FormWithReportViewer.Show()
FormWithReportViewer.Focus()
On the DataReport(.rdlc), we have to add a ReportParameters (Menu>Report>Report Parameters). The same name (OneParameter) should be used to avoid error. We can now use the parameter in our textbox, just put =Parameters!OneParameter.Value and we're done!
Note: We have to set the report parameters before rendering the report. If we cannot avoid that, refresh the report after adding parameters so it will be updated:
FormWithReportViewer.TheReportViewer.RefreshReport