|
Hello,
To include the report on the Web page, we need to drag and drop the Crystal Report Viewer control from the Toolbox. Because the Crystal Report Viewer control doesn't have a ReportSource property available at design time, you have to set that property inside your code.
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents CrystalReportViewer1 As CrystalDecisions.Web.CrystalReportViewer
#Region " Windows Form Designer generated code "
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CrystalReportViewer1.ReportSource = Server.MapPath("crystalreport1.rpt")
End Sub
End Class.
or you can create instance of the report class which was created by Visual Studio.NET when you designed your report. The name of that file is same as report that you create CrystalReport1.vb. To see this file expand CrystalReport1.rpt (click on + sign in front of the CrystalReport1.rpt).
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents CrystalReportViewer1 As CrystalDecisions.Web.CrystalReportViewer
#Region " Windows Form Designer generated code "
Dim crpt As CrystalReport1
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
crpt = New CrystalReport1()
CrystalReportViewer1.ReportSource = crpt
End Sub
End Class.
If you set WebForm1.aspx to be the Start Up page for the project, and start the project, you will get the report page if you have blank password in database for "sa". If "sa" or any other user name that you want to use to access database has password, when you run the report, you will see the "LogonFailed" error. If we were developing windows application, Crystal Reports will ask us for password information. This error occured, because when you design and save report, all of the connection information is saved within the report except password. If the password is blank, there will be no problem to create or generate the report.
To prevent this, you will need to provide login information in your code before you set ReportSource property. To do so, you will add some code in Page_Load event. Now, your code should look like:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents CrystalReportViewer1 As CrystalDecisions.Web.CrystalReportViewer
#Region " Windows Form Designer generated code "
Dim crpt As CrystalReport1
Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
crpt = New CrystalReport1()
For Each myTable In crpt.Database.Tables
myLogin = myTable.LogOnInfo
myLogin.ConnectionInfo.Password = "test"
myLogin.ConnectionInfo.UserID = "sa"
myTable.ApplyLogOnInfo(myLogin)
Next
CrystalReportViewer1.ReportSource = crpt
End Sub
End Class.
Now, if you run the report, you will not get an error page and evrything will look OK. The report will be generated and shown in your Web page.
Regards,
James
James Smith
www.componentone.com
|
|
|
|
|
Hi all
I have an application i want to delete tables from a word file with multiple columns
so i have to read the file
delete tables with multiple columns
The word file consist of both table and paragraphs. I want to delete tables which are having more than one column and save the content in a separate word file.
Regards
-- modified at 6:35 Wednesday 19th September, 2007
Prakash Mishra(Banglore,India)
|
|
|
|
|
How to transfer report from crystal report to excel using VB??
|
|
|
|
|
|
Hi friends..
Can anyone give me the code to get the memory status of a hard disk,,i.e i need to show the available memory space and used memory space..
Thanks & Regards,
Balaguru
|
|
|
|
|
this should help you on you'r way
My.Computer.FileSystem.Drives(0).AvailableFreeSpace
My.Computer.FileSystem.Drives(0).TotalSize
My.Computer.FileSystem.Drives(0).TotalFreeSpace
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
is there a way for me to force the string.replace() method, to replace the first instance of a substring rather than every instance?
There are 10 kinds of people in this world. Those who understand binary and those who don't...
______________________
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
|
|
|
|
|
Never mind.
I did it using Microsoft.VisualBasic.Replace().
I'm more than open to other suggestions.
There are 10 kinds of people in this world. Those who understand binary and those who don't...
______________________
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
|
|
|
|
|
Hello,
My query is related to application deployement.
I have created one application in vb.net and now want to deployment.
Suppose it requires 5GB of memory then in my setup project how can i check
physical memory required using launch condition.
Anyone who does know, please tell.
Thanks in advance.
|
|
|
|
|
I take it you mean 5GB of disk space or do you really mean 5GB of RAM?
You always pass failure on the way to success.
|
|
|
|
|
To be very specific, i have to check the disk space.
Thanks.
|
|
|
|
|
Hello,
I would suggest you to add reference for the System.management class in your project and I hope that following code will return the free physical memory
Dim freeMemory As New ManagementClass("Win32_OperatingSystem")
Dim memory As ManagementObjectCollection = freeMemory.GetInstances()
Dim memEnum As ManagementObjectCollection.ManagementObjectEnumerator = memory.GetEnumerator()
memEnum.MoveNext()
MessageBox.Show("Physical memory total space is: " & Format(Integer.Parse(memEnum.Current.Properties("FreePhysicalMemory").Value) / 1024, "#,### KB"))
I hope this helps.
James Smith
James Smith
www.componentone.com
|
|
|
|
|
I'd like to know can i print something that is in textBox or a listBox.
example of code:
dim output as String =txtInput.text
txtDisplay.text = output
I do i print this out? Thanx
Faruzzy.net!
|
|
|
|
|
Hello,
To print the text in a textbox, you would have to use the PrintDocument object. Using the
PrintPage() event for this object, you can set the printing preferences and the text to be
printed.
Lets say, you have a Textbox and a Button placed on a form. Drop a PrintDocument object on
the form from the toolbox.
In the Button_Click event, write the following code:
Me.PrintDocument1.Print() ' PrintDocument1 is the name of the PrintDocument Object.
Now in the PrintPage() event for PrintDocument1 object, place the following code:
(You can double click on the PrintDocument1 to get to the event)
Dim control As Control = TextBox1 ' you can change this to control of your choice
Dim myfont As Font = control.Font
Dim mybrush As New SolidBrush(control.ForeColor)
e.Graphics.DrawString(control.Text, myfont, mybrush, 12, 12)
mybrush.Dispose()
I believe this should help.
Regards,
Allen Smith
Software Engineer
ComponentOne LLC
www.componentone.com
|
|
|
|
|
Hi, Can someone please tell me how i can use an hovergradientButton, it seems that i have to import a class from the library or something like that, since i cant see that button in my toolbox...
Faruzzy.net!
|
|
|
|
|
Your best source of information on using a third-party library is the manufacturer of the library itself.
But, generally, you add a reference to the .DLL file that's supplying the library, then import the namespaces you need to use whatever classes you need.
For controls, you can add them to the ToolBox by right-clicking a tab in the ToolBox (while you have a form window open) and picking "Choose Items...". In the dialog that shows up, you click the Browse button and go find the library .DLL file and open it. The rest should be obvious.
|
|
|
|
|
Hello,
I am using VS2005 (Framework 2.0)
I am trying to share a folder through network.
I found 2 different codes that work perfectly.
The only thing I need is the sharing to be readonly.
Here is the first code:
Try
' create a directory
Directory.CreateDirectory("C:\ScanUtilityFiles")
' Create a ManagementClass object
Dim managementClass As New ManagementClass("Win32_Share")
' Create ManagementBaseObjects for in and out parameters
Dim inParams As ManagementBaseObject = managementClass.GetMethodParameters("Create")
Dim outParams As ManagementBaseObject
' Set the input parameters
inParams("Description") = "My Files Share"
inParams("Name") = "My Files Share"
inParams("Path") = "C:\MyShareFolder"
inParams("Type") = 0
' Disk Drive
' Invoke the method on the ManagementClass object
outParams = managementClass.InvokeMethod("Create", inParams, Nothing)
' Check to see if the method invocation was successful
If CInt((outParams.Properties("ReturnValue").Value)) <> 0 Then
Throw New Exception("Unable to share directory.")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
Here is the second code:
Dim info As New ProcessStartInfo()
info.UseShellExecute = True
info.WindowStyle = ProcessWindowStyle.Hidden
info.Arguments = "/c net share ScanUtilityFiles=C:\My Share Folder"
info.FileName = "cmd"
System.Diagnostics.Process.Start(info)
Please Help
Shay Noy
|
|
|
|
|
Could you show a little damn patience and stop posting the same question every flippin' day, please? You're spamming the forum with this.
Your code sample hasn't even begun to set the permissions on the share. A little time is required to put a sample together that you'd (maybe) understand.
|
|
|
|
|
I used to delete the olds posting that tends to be forgotten.
I google a lot and din't find any solution. I understand well the two examples that I had posted but I don't know how to set permission for read-only.
Thank you,
Shay Noy
|
|
|
|
|
Well, this isn't as easy as I thought it was going to be. You can't really use the built in .NET classes on the Share because the Share doesn't have any .NET classes around it yet.
The easiest way to do it, that I've found is to use more WMI stuff to create the access control lists. You can read up on it at We All Scream for Security Descriptors[^].
There's also some VBScript that is generic enough to modify here[^]. It's not very difficult to rewrite this sample into VB.NET, just time consuming.
|
|
|
|
|
I am using the propertygrid for the runtime controls . The problem is i amnot able to put the combobox on the top of the proprtygrid on the right side top which looks like in vs2005 Properties Window.How to put the combobox. and in the combobox i want to show the all thecontrols present on the form like in vs2005 properties Window.
Waiting For Response...
D.V.Sriram
|
|
|
|
|
You don't put it on or in the PropertyGrid, you put it above the PG. Then you populate it with your control names, or whatever, handle it's SelectedValueChanged event, then bind the PG the control selected by the ComboBox.
|
|
|
|
|
Thanks For Replying.....
I am using this code
Private Sub Properties_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim al As New ArrayList
For Each ctr As Control In whitepage.Controls
ComboBox1.Items.Add(ctr)
MessageBox.Show(ctr.ToString())
Next
End Sub
If i use like this , I am getting the panel ,Toolstip properties on the properties toolbox , But i am not able to see these instances on the properties toolbox . I created a form Properties in that i added ComboxBox1,PropertiesGrid1 and i am showing when i clicked on properties menuitem of popup menu . And i am not able to see the controls that are present on Panel like button1,button2 and runtime generated controls .How to get those instances ?? And how to set the dock for this form on my form ?? Any Idea Help me Out of this ..........
DVSRIRAM
|
|
|
|
|
dvsriram wrote: Private Sub Properties_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim al As New ArrayList
For Each ctr As Control In whitepage.Controls
ComboBox1.Items.Add(ctr)
MessageBox.Show(ctr.ToString())
Next
End Sub
This is because you only added the top level controls contained by whatever whitepage is. You didn't enumerate throught the child controls of each control.
Private Sub AddControlsToPropertyCombo(ByVal container As Control)
' Enumerate the controls in the root container
For Each ctr As Control In container.Controls
' adding each to the ComboBox
ComboBox1.Items.Add(ctr)
' If this control has child controls
If ctr.HasChildren Then
' Call this sub again using this control as the new parent container
AddControlsToPropertyCombo(ctr)
End If
Next
|
|
|
|
|
Hiii
When i am using this code i am getting the controls in to combo box but it is not showing the names of those instance and by showing the properties of those instances in propertygrid . If it shows names by ctr.name then it is not showing their properties in the propertygrid . This is the problem i am getting .
Help me out ...
DVSRIRAM
|
|
|
|