|
Hi,
Thanks for your reply. Basically I need to change the datasource of an On-demand sub report in the Drill event of Group in the crystal report viewer.
The first time when I set datasource to On-demand subreport it works perfectly and sub report load with the data. But next time when I set datasource to subreport the subreport doesn't come up with the new data.
The code I m using to set datasource is :
Private Sub crView_Drill(ByVal source As Object, ByVal e As CrystalDecisions.Windows.Forms.DrillEventArgs) Handles crView.Drill
Dim strsql As String
Dim objUtil As New clsReportUtil
Dim rpt As CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim ds As New DataSet
rpt = Me.crView.ReportSource
strsql = "Select * From tblDeliveryOrderHead " _
& "INNER JOIN tblCustomer ON tblDeliveryOrderHead.CustomerID = tblCustomer.CustomerID " _
& "Where CustomerName = '" & e.NewGroupName & "' "
ds = objUtil.GetDataSet(IBS_Utility.clsUtLib.GetConnectionString, strsql)
rpt.Subreports(0).SetDataSource(ds)
Dim subc As New CrystalDecisions.Shared.SubreportContext()
subc.SubreportName = rpt.Subreports(0).Name
subc.PageNumber = CType(source, CrystalDecisions.Windows.Forms.PageView).GetCurrentPageNumber
subc.Position = New System.Drawing.Point(1827, 2889)
tN.GroupLevel = e.NewGroupLevel
tN.GroupName = e.NewGroupName
tN.GroupNamePath = e.NewGroupNamePath
tN.GroupPath = New Integer() {e.NewGroupPath}
subc.ContainingGroupInfo = tN
CTyp(source,CrystalDecisions.Windows.Forms.PageView).DrillDownOnSubreport(subc)
rpt.Refresh()
End Sub
Regards
|
|
|
|
|
Just had a quick look but the first thing I noticed is that you don't set e.Handled to true . This prevents the default actions for drilling. Could that be the cause.
|
|
|
|
|
I have also tried this but it doesn't make any effect.
|
|
|
|
|
It's been a really long time since I last used Crystal so I don't remember the details accurately.
However another thing is that you don't really use source parameter. I'm wondering that are you actually creating a new subreport, but the one that you see is the one already defined in the main report. I didn't find what's the type of source in this case, but you could use debugger to see if you can take that as a starting point (use source for rpt variable instead of Me.crView.ReportSource) and so own.
|
|
|
|
|
Thanks for your suggestions. I am not creating new sub report. Sub report already exist in main report. The source parameter in this event is PageView.
Regards
|
|
|
|
|
Not sure about this, but it seems that the main report and the subreport are connected so the subreport is linked to the data in the main report datasource. Try if you can break the subreport connection (or link) in the designer with linking expert.
Another approach could be that you set and refresh both datasources (for the main report and the subreport):
...
rpt.Subreports(0).SetDataSource(ds)
rpt.SetDataSource(someOtherDs)
...
|
|
|
|
|
I've tried both the ways i.e linked & Unlinked Subreport.
The other approach I have not tried coz in case of main report I will need to hold a large dataset which holds some memory.
Regards
|
|
|
|
|
I think you should give it a try. Even if it's not the final solution, it could tell if that would solve the problem and if the problem is actually related to the main report.
|
|
|
|
|
Pl anyone Forward vb program for creating IE Toolbar with dropdown menu and icons
|
|
|
|
|
LMGTFY[^]
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I'll swap you, if you come and paint my house
I are troll
|
|
|
|
|
Would it be possible to prevent remove/repair dialog box appearing when running setup.exe if the application is already installed? The installed program should open in that case. I'm trying to create a multimedia presentation cd. I included autorun.inf file that opens the setup.exe file. What is the best method to achieve this?
|
|
|
|
|
Don't auto run the setup.exe. Have the application you run initially from the autorun do a check, if the application doesn't exist then run setup, if it does exist then run the application.
|
|
|
|
|
Thanx Colin. I had the same in mind, but since i can only program in VB.NET, the little checking appication on startup would need VB.NET framework already installed, which still wouldn't be installed because that is the roll of setup.exe. What programming language should i use for this checking task? C++? Could you give an example checking a registry key? A little console application in VB.NET could do it, but i think it also requires .net framework, doesn't it?
|
|
|
|
|
I solved it with a console application. It turned out VB.NET console application doesn't require .NET framework to run. This is the program:
Sub Main()
Dim s As String
Dim procID As Integer
If My.Computer.Registry.GetValue("HKEY_CURRENT_USER\SOFTWARE\Subroutine\ENERGOMONT", _
"Installed", 1000) = "Yes" Then
s = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\SOFTWARE\Subroutine\ENERGOMONT", _
"Path", 2000) & "Energomont.exe"
procID = Shell(s, AppWinStyle.NormalFocus)
Else
procID = Shell("setup.exe", AppWinStyle.NormalFocus)
End If
End Sub
I just have to figure out now how to prevent the console from appearing on the screen.
|
|
|
|
|
I can't find any good examples of how to do this in CP or Google.
I want to be able to auto scale my program no matter what PC resolution is set at. I think I can use the Auto Scaling. But I can't find any good examples. Maybe someone can look at the code and see if I even have it right.
Dim ctrl As ContainerControl
Dim dimens As SizeF
Dim ratio As SizeF
ctrl = New ContainerControl
ctrl.AutoScaleMode = Windows.Forms.AutoScaleMode.Dpi
dimens = ctrl.CurrentAutoScaleDimensions
ratio = Me.AutoScaleFactor
If dimens <> ratio Then
ctrl.PerformAutoScale()
End If
I am trying to see if the design values are the same as the runtime and if not perform autoscale, but nothing happens. Can someone help, please. Thank you.
|
|
|
|
|
http://msdn.microsoft.com/en-us/library/ms229605.aspx
|
|
|
|
|
Hi,
I am using the following script to write key and values into registry using vbscript.
this is my code
strComputer = "."Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")keyPath = "*\shellex\ContextMenuHandlers\WWBuildShell64Ext"Return = oReg.CreateKey HKEY_CLASSES_ROOT ,keyPath If (Return = 0) And (Err.Number = 0) Then Wscript.Echo "HKEY_LOCAL_MACHINE\Software\MyKey\MySubKey created"Else Wscript.Echo "CreateKey failed. Error = " & Err.NumberEnd If
It is retuning 6. What does it mean? how to correct it?
Please help me.
Thanks
|
|
|
|
|
About 10 seconds worth of Googling reveals that the return code 6 means that a handle is invalid. That would probably mean that you didn't define a value for HKEY_CLASSES_ROOT, which would put it's default value to 0. I don't think that's valid, so another Google for "VBScript HKEY_CLASSES_ROOT" says the declaration for it should be:
Const HKEY_CLASSES_ROOT= &H80000000
|
|
|
|
|
Hi,
I have a little problem. I'm trying to connect to a SQL Server Compact database that I have created called RunningDB.sdf. I'm having real problems with the connection string. I have search the internet and used numerous connection strings and still I Get the same error which is
SQL Exception
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Is there a problem with my sql server or is it just my connection string. Heres the connection string that Im using
Dim cn As New SqlConnection("Persist Security Info=True;Initial Catalog=RunningDB;Data Source=(local);Packet Size=4096;)
cn.Open()
Thanks for your time
|
|
|
|
|
carrigart wrote: Is there a problem with my sql server or is it just my connection string. Heres the connection string that Im using
That looks like you are trying to connect to a full SQL Server.
Have a look at ConnectionStrings.com[^] for some examples of what you should be doing.
|
|
|
|
|
Hello Carrigart,
Heres a link to some questions and answers to creating an SQL Compact Database (it includes connection strings).
Note the last message on the thread where I post the code I gleaned from the responses and it works fine for me now.
Hope followong helps:
1) Cut and paste the following link into your browser to get to it.
http://www.tek-tips.com/viewthread.cfm?qid=1458923&page=1[^]
2) Connection string example:
Protected Const SQLDBfullfilename As String = "C:\Users\KGM\Documents\Visual Studio 2008\Projects\RPMS_2008\RPMSDAL\myDB_2008a.sdf"
Protected Const SqlCeConnectionString As String = "Data Source='" & SQLDBfullfilename & "'; LCID=1033;Password='sa'; Encrypt = TRUE"
Oh and Don't forget to add a reference to System.Dat.SqlServerCE [Compact Database v3.5 which comes with SQL2008] in your project.
cheers
kmalone
When in doubt chuck it out!
|
|
|
|
|
Thanks for your reply,
After much head scratching I figured out that I was trying to connect to a SQL Server Compact db when in fact I should have been trying to connect to a sql server 2005 db. A good noobie mistake I hope. With that I have hit another stumbling block. I have opened my connection and I have setup up my DataAdapter and Im trying to fill my dataset and follows
da = New SqlDataAdapter("SELECT * FROM Testing", conn)
da.Fill(ds)
Testing is the name of a table in My Database, conn is my connection that has been opened. When I run the code I get a runtime error saying that
System.Data.SqlClient.SqlException was unhandled
Class=16
ErrorCode=-2146232060
LineNumber=1
Message="Invalid object name 'Testing'."
I dont know what is wrong. Im able to open a populate a dataset when I use Access but I have hit wall after wall with SQL Server
|
|
|
|
|
Hi All,
I have encountered this strange behaviour with Form.Show/ShowDialog. I am converting a VB.NET windows application to class library. For some reason VB developers like to call Show()/ShowDialog() directly on the class without instantiating it first. And it works fine in a Windows application project even though these methods are not static/shared.
But as as soon as I convert it to a Class Library project, I get zillions of "Reference to non-shared memeber requres an object referece" errors. It is complaining that I haven't instantiated the Form first. But it worked fine in the Windows Application project! So what am I missing? I really don't want to go through zillions of lines of code and instantiate each one of them.
If anyone has an answer to this, I will greatly appreciate it and will make payment in lots of good wishes.
Bolt.
|
|
|
|
|
Surely you won't be able to call Form.Show() from a class library anyway?
|
|
|
|