|
Hellow to all
how can i put a field in a crystal report , that i can contorl the text in it , from the code of the forum ..
that i can access it , and change it to what ever i wanna to from the code itself ?
thxx
-- modified at 4:32 Thursday 16th February, 2006
|
|
|
|
|
Hi
I have a form with 7 Datagrids. I populate DataTables from a database. I create a Dataview of the tables, and apply various filters based on user selections. I then use the DataVeiw as the Datagrid DataSource. I have also used Tablestyles to give the Datagrid Columns 'Readable' columnnames, and have adjusted the width of certain columns and set the columnwidth to 0 on some columns in order to hide them. This all works great.
Now I want to add the option to Export what displayed by the datgrids to Excel.
This is easy with a Datatable, since I can use the Column Names as headings, and then use a loop
For Each Col as Datacoumn in dtMyTable.Columns<br />
<br />
For each Row as datarow in dtMyTable.Rows<br />
cells(Row,Col) = ...<br />
Next 'Row<br />
<br />
Next 'Col
I'm battling to get the datagrid back into a table format - and cannot Ctype(Datagrid, DataTable) directly.
Any ideas how I can do this. (I'd like to be able to use the column headings and column widths of the datagrid to format the Excel sheet)
Thanx
Richard
|
|
|
|
|
I wish I knew an answer. I've been watching this message since you posted it, hoping someone would have the answer. I've ran into the same problem recently. If you figure out how I hope you'll followup and let me know what you find. Thanks
Lost in the vast sea of .NET
|
|
|
|
|
Have you tried:
Dim dSource As Object
dSource = DataGrid.DataSource
If TypeOf dSource Is DataView Then
Dim tbl As DataTable = CType(DataGrid.DataSource, DataView).Table
'Export to Excel...
End If
Dean
|
|
|
|
|
Hi Dean
Thanks 4 your reply. That works, but the problem is that I have a table with 6000 records. This Table is that datasource for a DataView. I then apply filters to the dataview. (So for example now the Dataview only has 100 Records) It is these 100 records that I want to put in a new table for export.
Using your method, it returns the full source table with all 6000 records.
I'd be happy to loop through the Dataview and adding those rows to a table, but can't seem to get that right.
Richard
|
|
|
|
|
You can pull data directly from the dataview which would allow you to only use the filtered data:
Dim i As Integer = 0
Dim dr As DataRowView
For Each dr In MydataView
ExcelWs.Cells(i, 1).Value = dr("Field1")
ExcelWs.Cells(i, 2).Value = dr("Field2")
.........
ExcelWs.Cells(i, n).Value = dr("Fieldn")
etc
i += 1
Next
Dean
|
|
|
|
|
I have a product Using VB6.0. How to provide product security? How to generate the key code for my product? That product ket is unique.After release this product,The customer install 2nd time this product,we will give the error "The key code already registered".So plz give some for Product security and How to generate Product key code?
Learn lot,
vijay.
|
|
|
|
|
|
crystal report with vb.net when i deploy on other computer & when i open report form, err "can't find keycodeV.dll"
help me pls.......................
shekhar
|
|
|
|
|
Create Setup project to deploy application, you can solve that problem
|
|
|
|
|
Hello,
u will have to make a setup project u can add setup project as:
- Add New Project
- Select Project type as "Setup and Deployment Wizard"
- Select Setup Wizard From Template
- A wizard will ask u some questions just complete it
- Now u have to add merge modules for crystal report which u can add as?
* Right Click on the Setup Project
* Add --> Merge Modules
* Select Following
** Crystal_Database_Access2003.msm
** Crystal_Database_Access2003_enu.msm
** Crystal_regwiz2003.msm
** VC_User_CRT71_RTL_X86_---.msm
** VC_User_STL71_RTL_X86_---.msm
- Build the solution
- A setup will be created in Setup Project Folders's -->Debug
- Copy it and run it on client machine
Regards
Javed
|
|
|
|
|
|
You need to register with Crystal Reports first. Then in your setup directory include the proper DLLs as mentioned in CR's documentations.
- Malhar
|
|
|
|
|
Hello,
I want to place my application on server and place short cut on client to run the application.
Thanks
Javed
|
|
|
|
|
That'll work fine "provided" that all of the app's dependencies are installed on the client system.
Dependencies such as the vb runtime, any ActiveX's used, etc.
|
|
|
|
|
In addition to what Joshua said, in a .NET Framework environment, this also means (in most cases) changing the trust level for your application on each client machine. Code running from a network source runs in a more restrictive "sandbox". The affects of which will not be known until you test your code running from the network.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Our shop has a good many applications setup this way. You need to make sure the correct version of the framework is installed on each client.
Also, if you decide to use Crystal Reports in the application, there are merge modules that need to be installed on the client's machine. I believe VS 2005 addresses this problem, but we were using 2003 at the time.
As Dave already mentioned, security is a big factor. You have to adjust the trusts on the client's machine to execute an application on the server. We used a MSDN support call on the security issue and below are the links he gave us. Maybe this info can help with the security issues.
Because of some of these issues our shop is looking into clickonce deployment in VS 2005 to be a better solution for us in the future. We just installed VS 2005 this week so we're just starting to figure out the new features.
Good luck!
SAMPLES
No-Touch deployment - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchNo-TouchDeploymentInNETFramework.asp
.NET Security Samples - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvssamp/html/vbcs_RoleBasedSecurity.asp
MODIFYING SECURITY
URL Security Zones: http://msdn.microsoft.com/library/default.asp?url=/workshop/security/szone/urlzones.asp
Configuring Permission Sets Using the .NET Framework Configuration Tool - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconusingnetconfigurationtooltoworkwithpermissionsets.asp
Project Folder Not Secure Dialog Box - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vxurfprojectfoldernotsecuredialogbox.asp
Performing Common Security Policy Tasks Using the .NET Framework Configuration Tool - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconperformingcommonsecuritypolicytasksusingnetframeworkconfigurationtool.asp
Deploying Security Policy - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpcondeployingsecuritypolicy.asp
DEFINITIONS
Security Permssions - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemsecuritypermissions.asp
Name Permission Sets - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconnamedpermissionsets.asp (This has the definition for "Local Intranet", as I mentioned before this should be every computer within the domain)
Security Zones: - http://msdn.microsoft.com/library/default.asp?url=/workshop/security/szone/overview/overview.asp
Lost in the vast sea of .NET
|
|
|
|
|
I need my program to wait for 100 milli seconds before proceeding to a particular statement from the previous one. I can use Sleep() command in VC++ but i do not know anything about vb.NET please tell me how can I do this.
Regards,
Rajesh R. Subramanian
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
System.Threading.Thread.Sleep(100)
!alien!
|
|
|
|
|
Hi, I need to export data from a dataset (datatable) into Excel or csv format. Can anyone help me out with this.
With Best Regards,
Mayur
-- modified at 0:02 Thursday 16th February, 2006
|
|
|
|
|
|
Are there any examples for vb.net
With Best Regards,
Mayur
|
|
|
|
|
Hi
You need to add a reference to Microsoft Excel 10 Object Library.
There are other examples where you do not use the com object, which have the advantage that Excel does not need to be installed on the target machine.
Then:
<br />
Private Sub ExportExcel(ByRef dt As DataTable) <br />
Dim excelApp As New Excel.Application<br />
Dim excelBook As Excel.Workbook = excelApp.Workbooks.Add<br />
Dim excelWorksheet As Excel.Worksheet = _<br />
CType(excelBook.Worksheets(1), Excel.Worksheet)<br />
Dim dr As DataRow<br />
Dim Row As Integer = 1<br />
Dim Col As Integer = 1<br />
<br />
excelApp.Visible = False<br />
If dt.Rows.Count > 65536 Then<br />
MessageBox.Show("Warning - Excel sheet can only have 65536 Rows" _<br />
& ControlChars.NewLine & ControlChars.NewLine _<br />
& 65536 - dt.Rows.Count & " Rows will be omitted")<br />
End If<br />
If dt.Columns.Count > 256 Then<br />
MessageBox.Show("Warning - Excel sheet can only have 256 Rows" _<br />
& ControlChars.NewLine & ControlChars.NewLine _<br />
& 256 - dt.Columns.Count & " Columns will be omitted")<br />
End If<br />
With excelWorksheet<br />
'Headings<br />
For Col = 0 To dt.Columns.Count - 1<br />
.Cells(1, Col + 1).Value = dt.Columns(Col).ColumnName<br />
.Cells(1, Col + 1).Font.Bold = True<br />
.Cells(1, Col + 1).ColumnWidth = Len(dt.Columns(Col).ColumnName) + 3<br />
Next<br />
<br />
<br />
.Range("A:Z").NumberFormat = "@" '(Text Format...)<br />
<br />
Row = 2<br />
Col = 0<br />
'Data<br />
Do While Row < dt.Rows.Count - 1 And Row < 65536<br />
Do While Col <= dt.Columns.Count - 1 And Col < 255<br />
.Cells(Row, Col + 1) = dt.Rows(Row - 2).Item(Col)<br />
Col += 1<br />
Loop<br />
Col = 0<br />
Row += 1<br />
Loop<br />
End With<br />
excelApp.Visible = True<br />
End Sub
-- modified at 4:37 Thursday 16th February, 2006
|
|
|
|
|
|