|
How to pass the value from vb to crystal report?
For example value text in textbox = "Company" can appear in my crystal report.
Thanks
|
|
|
|
|
Make Parameter and pass the values to display..
.. I have copied this code from my project and removed couple of parameters to make it easy. if any line is extra or has not concern it means I for got to delete that...
' note ::: crpt is the crystal report component...
Dim opt As New report1
Dim paramFields As New CrystalDecisions.Shared.ParameterFields()
Dim paramFieldsRoom As New CrystalDecisions.Shared.ParameterField()
Dim paramField As New CrystalDecisions.Shared.ParameterField()
Dim discreteValTotal As New CrystalDecisions.Shared.ParameterDiscreteValue()
paramFieldsTotal.CurrentValues.Add(discreteValTotal)
paramFieldsTotal.ParameterFieldName = "TotalPages"
crpt.ParameterFieldInfo.Add(paramFieldsTotal)
opt.Load()
opt.Refresh()
' if any selection formula
' opt.RecordSelectionFormula = SelectionFormula
crpt.ReportSource = opt
crpt.Show()
|
|
|
|
|
The paramfields, paramfieldsroom etc will appear in "Parameter field" at crystal report design right?
|
|
|
|
|
|
Can i know what value you pass from your code?
|
|
|
|
|
use MSDN write Parameters and in the list check crystal you will get some code. this is also from there
Dim paramFields As New ParameterFields()
Dim paramField As New ParameterField()
Dim discreteVal As New ParameterDiscreteValue()
Dim rangeVal As New ParameterRangeValue()
' The first parameter is a discrete parameter with multiple values.
' Set the name of the parameter field, this must match a
' parameter in the report.
paramField.ParameterFieldName = "Customer Name"
' Set the first discrete value and pass it to the parameter
discreteVal.Value = "AIC Childrens"
paramField.CurrentValues.Add(discreteVal)
' Set the second discrete value and pass it to the parameter.
' The discreteVal variable is set to new so the previous settings
' will not be overwritten.
discreteVal = New ParameterDiscreteValue()
discreteVal.Value = "Aruba Sport"
paramField.CurrentValues.Add(discreteVal)
' Add the parameter to the parameter fields collection.
paramFields.Add(paramField)
' The second parameter is a range value. The paramField variable
' is set to new so the previous settings will not be overwritten.
paramField = New ParameterField()
' Set the name of the parameter field, this must match a
' parameter in the report.
paramField.ParameterFieldName = "Customer ID"
' Set the start and end values of the range and pass it to the 'parameter.
rangeVal.StartValue = 42
rangeVal.EndValue = 72
paramField.CurrentValues.Add(rangeVal)
' Add the second parameter to the parameter fields collection.
paramFields.Add(paramField)
' Set the parameter fields collection into the viewer control.
crystalReportViewer1.ParameterFieldInfo = paramFields
crystalReportViewer1.ReportSource = "c:\reports\my report.rpt"
|
|
|
|
|
I can display simple discrete value already, but when i refresh crystal report viewer why there is pop up message to input the discrete value again? I wan to remove this.
And for range value i failed, what is it for? when it is displayed what we can see?
|
|
|
|
|
you are missing some parameter to pass. the value which are getting prompt is the one. if you have assigned this value in parameter then I guess you missed to assign parameter to the report. you are creating a parameter vaue but not attaching it to the report
|
|
|
|
|
SqlDataAdapter2.Fill(DataSet21, "accounts")
crystalReport11.SetDataSource(DataSet21)
Dim pFields As New ParameterFields
Dim pField As New ParameterField
Dim disVal As New ParameterDiscreteValue
Dim rVal As New ParameterRangeValue
pField.ParameterFieldName = "Test"
disVal.Value = "CodeProject"
pField.CurrentValues.Add(disVal)
'rVal.StartValue = 150
' rVal.EndValue = 200
'pField.CurrentValues.Add(rVal)
pFields.Add(pField)
CrystalReportViewer1.ParameterFieldInfo = pFields
CrystalReportViewer1.ReportSource = crystalReport11
============================
Above code i have not make use of range value yet.
Parameter Filed named "Test" is the one i create in crystal report at design time and i drag and drop this field somewhere in my report design. First I load it is fine and display CodeProject and when i press refresh button from crystral report viewer, a dialog box pop up and ask me to input discrete value again where it suppose show CodeProject again and no need user input anymore. and i guess i have assing value to the parameter. or not?
|
|
|
|
|
Confirm one thing. creating Report there is an option save data with report in file menu. uncheck that .. other wise it is working fine with me.
|
|
|
|
|
Do u mean file menu at toolbar? i cant find to uncheck option save data.
Are u sure when u press refresh button at crystralreportviwer there is no dialog box pop up said u need to input discrete value again>?
can set this use code?
|
|
|
|
|
as far the menu is concerned it is if you are building the report in crystal report designer then it will work. in other case dot net plateform I dont think this is required.
Yes I reloaded the project ran the report and click refresh and no dialog appeared. I dont know why it is coming at your end. I used crystal 9 and crystal 10 both have no problem in refreshing. Well I gues if you still have the problem then put it in the forum with this issue may be some one can guide you properly as I am missing any point
|
|
|
|
|
How can i write in betwwen a file.Lile i am searching for a string in afile and once that string is found it should right in the next line .
smita
|
|
|
|
|
Are you saying that you're trying to Insert text in the middle of a text file?
You have to rewrite the text file. Either all of it, or just the part from where you insert the line to the end of the file.
Do your search, find the line that you want to insert text after. Remember the position of file pointer (after the text you find) then read everything from that point on to the end of the file. Move the file pointer back to the position you remembered. Write your inserted line/block of text, then write every you read before.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Is there any event to catch when
files are drop on the excel sheet
for office com addin in VB?
Shin
|
|
|
|
|
help please...i don't know what to do anymore. i'm learning .net remoting where i'm trying to use IIS as the activation agent and i tried everythin i can think of but i can't fix this exception:
System.Runtime.Remoting.RemotingException: Requested Service not found
please advice....i will really appreciate any help thanks!
|
|
|
|
|
hye there
Well I know you have tried alot . but just for reminder.. you have to start your remote hosting application first. second thing is do not include the hosting application in your solution if you have hosted them on the other machine. make sure you have mentioned the ports and system name correct. test system name through ping command to confirm it is responding on network.
I have one test application let me search for that if I found I shall send it over. for testing you can use this CSharp as well
http://www.codeproject.com/csharp/remotinggui.asp[^]
|
|
|
|
|
yes please send it over if you found it . i'm not getting the exception(service requested is not found)anymore. however, it's still not working properly ...i don't know if it is me or the code given in the book. i'm newbie in .net remoting
|
|
|
|
|
Hi,
I am starting with VB.NET and I downloaded VS.NET 2005 BETA 2 (the full edition named "Team").
I already have an application written in vb.net (framework 2.0) and I'm not finding the way to put this script (msn alert) to work!
http://www.codeproject.com/cs/miscctrl/taskbarnotifier.asp[^]
In the tutorial he says: First of all, copy TaskbarNotifier.cs in your project directory.
Add on the top of your source code the directive: using CustomUIControls;
1) Where I find the "top of my source code" ? I just can see the classes that I created in the code view.
2) What is a "member variable in my class" and how I set it up in vb.net?
3) Where may I edit my "constructor" ?
Thanks in advance!
|
|
|
|
|
LPalma wrote:
I am starting with VB.NET
LPalma wrote:
First of all, copy TaskbarNotifier.cs in your project directory.
.cs means C#. Can you mix and match C# and VB.NET within the same project in 2005 ? I thought you could only do that in ASP.NET projects ?
LPalma wrote:
1) Where I find the "top of my source code" ?
Go to the source file where you want to use this class. I'm not sure how to say this without it coming off as sarcastic, but here goes - there is a scroll bar on the right of the screen, move it to the top.
LPalma wrote:
) What is a "member variable in my class" and how I set it up in vb.net?
A variable that exists inside your entire class. So you define it inside the class, but not inside a method, and then the entire class can see/access it.
LPalma wrote:
Where may I edit my "constructor" ?
Your constructor is the method that is called the same as your class. It gets called when a new instance of your class is constructed.
It sounds to me like you have a lot to learn before you start trying to use other peoples code. Getting something that looks cool up quickly may feel good, but if you don't know the absolute basics, it's a recipe for disaster. Buy yourself a beginner book on VB.NET ( a 2003 book will probably do ), and work through it before continuing this project.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi Christian,
First of all, thanks for the answer!
I'm using the "TaskbarNotifier.vb" file which is included in the pack. So, I'm not mixing C# and VB.NET.
The "top of my source code" which as I was talking about is that part hidden by default (isn't it?). Scrolling the bar like you are saying (I know you weren't sarcastic) I can just see the clasess that I wrote. I am looking for the code that VisualStudio creates automatically (Imports, the name of the form, title of the form, default icon for the form, etc...). I can't see it by just scrolling. Once I got to the code, but I forget how to access it.
About buying the book, I'm waiting for framework 2.0... because I think v1.1 isn't so complete and framework changed a lot from 1.1 to 2.0.
Thanks for your time.
|
|
|
|
|
LPalma wrote:
I'm using the "TaskbarNotifier.vb" file which is included in the pack. So, I'm not mixing C# and VB.NET.
OK, you said .cs file. You meant .vb file.
LPalma wrote:
I am looking for the code that VisualStudio creates automatically (Imports, the name of the form, title of the form, default icon for the form, etc...).
Yes, a using statement exists at the top, in fact, you should see a group of them. Search your code file for using and see where it takes you, that's where they go. IT's not THAT critical ( as in, they don't need to go EXACTLY there ), but they will be in a group at the top. You should only have one class in each file, in almost all cases.
LPalma wrote:
Once I got to the code, but I forget how to access it.
A lot of auto generated code is hidden behind a comment with a + tag. You can create these yourself with #region and #end region in your code, then you can hide a section of code by clicking the +. Never mess with this code though, if it's in a method. The designer auto generates this.
LPalma wrote:
About buying the book, I'm waiting for framework 2.0... because I think v1.1 isn't so complete
I disagree. Sure, it's getting better, but there's no reason to wait at least 6 months before you can start learning. PLenty of full features apps have been written with 1.0/1.1. Do you ahve the beta of 2005 ? If so, you can certainly buy books on it today.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
I disagree. Sure, it's getting better, but there's no reason to wait at least 6 months before you can start learning. PLenty of full features apps have been written with 1.0/1.1. Do you ahve the beta of 2005 ? If so, you can certainly buy books on it today.
Yes, I'm beta testing SQL Server 2005 and they give us VS.NET 2005 B2 and I find it interesting and I started creating simples applications for home use. One of them has already 1000 lines codes and it just work perfectly (Yeah, VS2005 is so ease that I could use it just knowing ASP 3)
However, as I never used so complete tool, I'm a bit dizzy with these names "Constructor, Imports, etc"... I'll try to find a book to learn the basics, I tried to skip the begin, but it isn't working. eheheheh.
Thanks!
|
|
|
|
|
LPalma wrote:
However, as I never used so complete tool, I'm a bit dizzy with these names "Constructor, Imports, etc"... I'll try to find a book to learn the basics, I tried to skip the begin, but it isn't working. eheheheh.
Yeah, ASP.NET 2005 has a lot of automagic stuff built in, which means you can get a lot done, and still have no idea about programming. I see this as a bad thing, although so long as you do some study so you know what's going on, it's obviously productive to not need to write reams of code to get a little thing done.
Introducing Microsoft Visual Basic 2005 for Developers (Pro - Developer)[^] looks like a good book for you. Amazon also has one on SQL Server 2005.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
looks like a good book for you. Amazon also has one on SQL Server 2005.
Thanks for the book. I'll check with my local book store if they can import it (I'm not from USA, as you may have notice because of my English).
|
|
|
|