|
Hi all, i am using visual studio 2010 and trying to add a dynamic image into the crystal report, i dont want to use dataset, how could i assign a URL to the image, and just change the image with the same name (ex: c:\logo.jpg different image than the existing one but the same name) and the report read it.
thanks for your replies
|
|
|
|
|
|
SystemNullReferenceException means that you are trying to use an object reference that has not been initialized. Use your debugger to find the line of code where it occurs.
|
|
|
|
|
Message Closed
modified 21-Aug-15 4:27am.
|
|
|
|
|
I have a feeling that your issue is somewhere in load1
It could be any of the following
1. Un-initalised object that you are trying to assign to
2. Trying to access / modify a collection at the same time from one or more threads without using either a multi threaded safe object or locking of the object
3. trying to update the UI from a separate thread with the use of delegates etc.
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
|
Wrong forum, try the Lounge.
|
|
|
|
|
noted, please help to remove this, thanks.
|
|
|
|
|
if(ex.Message.Contains("Row not found or changed."))
{
log.WriteErrorToLog("got this error message:" + ex.Message + " See dictionary values below." , "AddOrder_DEBUG_LOG");
foreach (KeyValuePair<string, object="">kvp in dict)
{ log.WriteErrorToLog(kvp.Key + "=" + Iif(kvp.Value == null, "null", kvp.Value.ToString()), "AddOrder_DEBUG_LOG"); }
log.WriteErrorToLog("******DEBUG END**********", "AddOrder_DEBUG_LOG");
SendEmail("xxxxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx " + xxxxxxxxxxxxxx + ". xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "", "", false); }
else if
(ex.Message.Contains("xxxxxxxxxxxxxxxxxx")) { WriteToLog(ex.Message + ex.StackTrace, "Exception", "AddOrder"); SendEmail("xxxxxxxxxxx", "xxxxxxxxxxxxxxxxx " + DateTime.Now, "xxxxxxxxxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxx", "", "", false); }
else if
(ex.Message.Contains("Timeout expired."))
{ WriteToLog("DealerImport query timeout around " + DateTime.Now + " Details:" + ex.Message, "Exception", "AddOrder"); }
else if
(ex.Message.Contains("xxxxxxxxxxxxxx.")) { WriteToLog("Someone killed the DealerImport query around " + DateTime.Now + " Details:" + ex.Message, "Exception", "AddOrder"); }
else {
if (ex.InnerException != null) { WriteToLog(ex.Message + ex.StackTrace + ex.InnerException.Message.ToString(), "Exception", "AddOrder"); }
else { WriteToLog(ex.Message + ex.StackTrace, "Exception", "AddOrder"); } } } return result;
}

modified 13-Aug-15 0:06am.
|
|
|
|
|
What is the question (it is certainly not a line of emojis)?
|
|
|
|
|
Can this code fragment be serialized Sir@Richard MacCutchan?
|
|
|
|
|
That makes no sense. Please explain in detail what problem you are trying to solve. Perhaps the word serialize means something different to you.
|
|
|
|
|
The process of converting an object into a stream of bytes in order to store the object or transmit it to memory, a database, or a file is Serialization in C# right? i dont have an idea how to do it though...
|
|
|
|
|
|
even i was confused i already did that unfortunately i failed to link it with that.. in the articles its always showing a class that fragment is out of nowhere my prof is not around i don't know what to do.. any suggestions? anyway thanks for answering 
|
|
|
|
|
Follow the link I gave you, there is a reference to the MSDN documentation and also a CodeProject article.
|
|
|
|
|
I have followed WPF TabControl: Turning Off Tab Virtualization[^] to be able to have tabs that don't recreate their contents each time.
Recently I found out that if you close a tab for example the content is not destroyed!
For example if you add a browser with a video in it the video will continue to play.
The content seems to be stored in a property, I can't figure out how to remove it for good.
This is done with data binding and a DataTemplateSelector.
Any help would be greatly appreciated.
|
|
|
|
|
You should ask this on the article forum. The author will be notified of questions.
|
|
|
|
|
I asked, but I don't see much activity there recently. So I know that the content is stored in a property and I would just like a generic wpf answer how to remove content (UI controls) that are stored in a property.
|
|
|
|
|
I need to edit code to add in C# code for a method called readInteger which has the following signature:
int readInteger ( string prompt )
but I don't know how; can anyone tell me the code I would use?
thanks
|
|
|
|
|
There is a "ReadLine" method on the Console class. ReadInteger can be found on various reader-classes, but could also be from some other class.
Given that it needs a string as a prompt, I would guess that it is a bit o' homework where you display the prompt on the console, ask for a valid integer, provide feedback if it isn't, and then return the result.
If it is homework then please copy the entire question.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
The program presently performs the number reading for the item price inside the main loop. Improve the structure of the program by writing the C# code for a method called readInteger which has the following signature:
int readInteger ( string prompt )
Modify the program to use this method.
class PriceCalc { static void Main(string[] args)
{
float costPrice = 0.0f;
float profit;
float tax; float totalCost = 0.0f;
float totalProfit = 0.0f;
float totalTax = 0.0f;
bool finished = false;
float salePrice;
string priceString;
string nameString; float taxRate = 0.2f;
while (!finished) {
Console.Write("Enter the name of the product : ");
nameString = Console.ReadLine(); Console.WriteLine("Product is " + nameString);
if (nameString.Length != 0) {
finished = true;
} else
{ bool dataOK = false;
while (!dataOK)
{
Console.Write("Enter price of the product : ");
priceString = Console.ReadLine(); try {
costPrice = float.ParsepriceString); dataOK =true; catch
{
Console.WriteLine("That is not a valid number");
Console.WriteLine("Enter a number, e.g. 15.5");
}
}
if (costPrice < 20.0f) {
profit = costPrice * 0.2f;
} else { if (costPrice < 40.0f) {
profit = costPrice * 0.15f; // } else
{
profit = costPrice * 0.1f;
}
}
tax = (costPrice + profit) * taxRate;
totalTax = totalTax + tax; totalCost = totalCost + costPrice; totalProfit = totalProfit + profit;
salePrice = costPrice + profit + tax;
|
|
|
|
|
 Ask and ye receive
The indentation is screwed up by the browser due to the formatting. I've cleaned it up and added it below in pre-tags;
using System;
class PriceCalc
{
static void Main(string[] args)
{
float costPrice = 0.0f;
float profit;
float tax;
float totalCost = 0.0f;
float totalProfit = 0.0f;
float totalTax = 0.0f;
bool finished = false;
float salePrice;
string priceString;
string nameString;
float taxRate = 0.2f;
while (!finished)
{
Console.Write("Enter the name of the product : ");
nameString = Console.ReadLine();
Console.WriteLine("Product is " + nameString);
if (nameString.Length != 0)
{
finished = true;
}
else
{
bool dataOK = false;
while (!dataOK)
{
Console.Write("Enter price of the product : ");
priceString = Console.ReadLine();
try
{
costPrice = float.Parse(priceString);
dataOK = true;
}
catch
{
Console.WriteLine("That is not a valid number");
Console.WriteLine("Enter a number, e.g. 15.5");
}
}
if (costPrice < 20.0f)
{
profit = costPrice * 0.2f;
}
else
{
if (costPrice < 40.0f)
{
profit = costPrice * 0.15f;
}
else
{
profit = costPrice * 0.1f;
}
}
tax = (costPrice + profit) * taxRate;
totalTax = totalTax + tax;
totalCost = totalCost + costPrice;
totalProfit = totalProfit + profit;
salePrice = costPrice + profit + tax;
}
}
Console.ReadKey();
}
}
At this moment, your entire program is a single method, and it would make it harder to reuse parts. If you would write a larger application like this, you'd end up with a lot of repeating and hard to maintain code.
The line "static void Main(string[] args)" is an example of a methods signature. It states the methods argument(s) and its name. Adding such a method to the code would give a different structure;
class PriceCalc
{
static int readInteger (string prompt)
{
Console.WriteLine(prompt);
priceString = Console.ReadLine();
return priceString;
}
static void Main(string[] args)
{
float costPrice = 0.0f;
float profit;
..and so on
You'd then be able to call this new method from your main-method like below;
Console.Write("Enter price of the product : ");
priceString = Console.ReadLine();
priceString = readInteger("Enter price of the product : "); Now you have a new design-decision to make; will you implement the error-handling in the new method, or would you keep it in the main-method?
Some additional notes;
--edit;
Nearly forgot an important part, without which the code will not execute; you need to add the word "static" to the methods signature like below, or it won't work (updated the example above also);
static int readInteger (string prompt) If you are not allowed to change the signature, then you'd additionally need to create a class, and create an object of that type before using it.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
thank you so much! that's so helpful!!! 
|
|
|
|
|
You're welcome, and thanks 
|
|
|
|