|
When you open your first excel instance, set the property
IgnoreRemoteRequests to true, it will prevent explorer from popping up your first excel instance when you run your second through explorer.
|
|
|
|
|
That's what I was looking for.
Thank you very much.
|
|
|
|
|
Hi to all,
I am currently working on vs2008 generating powerpoint presentations.
I have a problem in representing the entire set of data into a table using vs2008 in a powerpoint
Can anyone suggest me in this matter how to proceed
Thanks inadvance
sai krishna
|
|
|
|
|
I think you should give a try using Interop.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
How are you creating the Powerpoint presentation?
Are you using the PIA's or some other method?
|
|
|
|
|
hi i m creating a predefined template in that i want to bind the database values into the powerpoint using vs2008 in a form of grid i want to display the table values into the powerpoint
sai krishna
|
|
|
|
|
OK, but what are you using to generate the the powerpoint presentation?
Are you importing Microsoft.Office.Interop.PowerPoint?
|
|
|
|
|
yes scott iam importing that namespace
i m writing in my button click event like this
{
int count = 0;
string strTemplate = string.Empty;
int shpCount = 1;
//core.MsoTriState objTriState = core.MsoTriState.msoTrue;
string strPPTName = @"d:\EDPresentation.pptx";
string strPPTPath = @"D:\PPT-Opty1\PPT-Opty\";
strTemplate = strPPTPath + "Presentation5.pptx";
Application objApp = new ApplicationClass();
_Presentation objPres = objApp.Presentations.Open(strTemplate, core.MsoTriState.msoFalse, core.MsoTriState.msoTrue, core.MsoTriState.msoFalse);
Slides objSlides = objPres.Slides;
TextRange objTextRng;
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
objSlides.InsertFromFile(strTemplate,count, 1, 1);
_Slide objSlide = objSlides[ds.Tables[0].Rows.Count-1];
//for (shpCount = 1; shpCount <= objSlide.Shapes.Count; shpCount++)
//{
Microsoft.Office.Interop.PowerPoint.Shape objShape;
// foreach (DataColumn dc in ds.Tables[0].Columns)
// {
// if (objSlide.Shapes[shpCount].AlternativeText.Trim().Equals(dc.ColumnName))
// {
objShape = objSlide.Shapes[shpCount];
objSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 100, 100, 100, 80);
objShape.TextFrame.TextRange.Text = ds.Tables[0].Rows[i][dc.ColumnName].ToString();
}
objPres.SaveAs(strPPTName, PpSaveAsFileType.ppSaveAsPresentation, core.MsoTriState.msoTrue);
objPres.Close();
objApp.Quit();
}
sai krishna
|
|
|
|
|
string from,to;
from=this.dateTimePicker1.Value.ToShortDateString();
to=this.dateTimePicker2.Value.ToShortDateString();
string str="select * from Furn_Info where Time between ‘"+from+"’
and ‘"+to+"’";
but it do not work as i think ,i'm use data SQl2000
please show me how can i do
|
|
|
|
|
Hi, there are many reasons behind not getting resultset. some of them can be your datepicker value is not in correct date format as SQL expects, or check your system date formats, or just format date value before adding to query.
Avinash S. Godse
|
|
|
|
|
Try this:
from=this.dateTimePicker1.Value.ToString("yyyy/MM/dd");
to=this.dateTimePicker2.Value.ToString("yyyy/MM/dd");
|
|
|
|
|
miss YY wrote: string str="select * from Furn_Info where Time between ‘"+from+"’
and ‘"+to+"’";
Rather parameterize your queries like so:
cmd.CommandText = "select * from Furn_Info where Time between @from and @to";
cmd.Parameters.AddWithValue("@from", from.ToString("yyyyMMdd"));
cmd.Parameters.AddWithValue("@to", to.ToString("yyyyMMdd"));
|
|
|
|
|
Yes parameterize, but don't make the dates into strings.
|
|
|
|
|
Why not?
How would you do it, just put the DateTime object as the parameter value?
|
|
|
|
|
ScottM1 wrote: put the DateTime object as the parameter value?
Of course.
|
|
|
|
|
I am trying to understand delegates and events in C Sharp. I am finding the subject confusing. Please consider the following program:
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Text;<br />
<br />
public class StockArgs : EventArgs {<br />
public StockArgs( String symbol, string price, int volume )<br />
{<br />
this.symbol = symbol;<br />
this.price = Decimal.Parse(price);<br />
this.volume = volume;<br />
}<br />
public string Symbol {<br />
get<br />
{ return symbol; }<br />
}<br />
public string Price {<br />
get<br />
{ return Price; }<br />
}<br />
<br />
private string symbol;<br />
private decimal price;<br />
private int volume;<br />
}<br />
<br />
public class Stock {<br />
public delegate void StockPiraceAlertHandler( object source, StockArgs a);<br />
public event StockPiraceAlertHandler OnAlert;<br />
<br />
public delegate void VolumeAlertHandler(object source, StockArgs a);<br />
public event VolumeAlertHandler OnVolumeAlert;<br />
<br />
public void Alert()<br />
{<br />
if ( OnAlert != null )<br />
OnAlert( this, new StockArgs("ORCL", "14.50", 100000) );<br />
}<br />
<br />
}<br />
<br />
public class Main {<br />
public static void Main()<br />
{<br />
Stock stock1 = new Stock();<br />
stock1.OnAlert(null, null);<br />
}<br />
}
In the main routine (called Main) I want to trigger the alert called OnAlert. However, the code does not compile. Furthermore, the compiler error message implies that alerts can be only generated by the class that defines the alert. If that is true, then it seems like a major deficiency with alerts in C sharp. However, I suspect I am missing one or more key points. Please enlighten me.
I thank the group in advance for their responses.
Bob
|
|
|
|
|
Hi Bob,
When your Main (or any other code) wants to do something to stock1, it should set one of its properties, or call one of its methods.
events are meant to be used the other way around; they exist for the external world (Main) to be signaled by something that happens inside your class (Stock), as in:
class MyForm : Form {
public MyForm() {
Button btn=new Button();
this.Controls.Add(btn);
btn.Click+=new EventHandler(myClickHandler);
...
public void myClickHandler(object sender, EventArgs e) {
}
}
and the Button class would contain something like:
if (a click got detected) {
if (this.Click!=null) this.Click(this, new EventArgs());
}
so it is Button who executes its own event, and MyForm who subscribed to it by adding its myClickHandler to the public event.
And all this holds true for .NET, not just for C#.
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
For triging event in C# you have to do more like :
<code>
public static void Main()
{
Stock stock1 = new Stock();
stock1.OnAlert += new Stock.StockPiraceAlertHandler(stock1_OnAlert);
stock1.Alert();
}
static void stock1_OnAlert(object source, StockArgs a)
{
}
</code>
|
|
|
|
|
The Main class should not tell the Stock class to raise its event. It can be done, but it's not a good design. Usually we see this error when a derived class tries to raise the event of a base class; I've never seen anyone try to do what you are trying to do.
|
|
|
|
|
Stock class owns those events. Main is just a subscriber who will get notification when the event occurs. To get event notification, you need to subscribe to it first.
public static void Main()
{
Stock stock1 = new Stock();
stock1.OnAlert += AlertOccured;
stock1.Alert();
}
private void AlertOccured(object source, StockArgs a)
{
} Delegates are the backbone of events. The main difference is events can be raised only by the class which declares them where a delegate instance can be invoked by anyone who have access to it. Following example shows what I meant.
public delegate void ADelegate();
class Foo
{
public ADelegate ADelegateInstance;
public void FireADelegate()
{
if (ADelegateInstance != null)
ADelegateInstance();
}
}
class Program
{
static void AMethod()
{
Console.WriteLine("AMethod()");
}
static void Main(string[] args)
{
Foo f = new Foo();
f.ADelegateInstance += AMethod;
f.ADelegateInstance();
}
} Now if you change public ADelegate ADelegateInstance to public event ADelegate ADelegateInstance the code won't compile. f.ADelegateInstance() is invalid here.
If you are following the standard void method(object, EventArgs) pattern for events, you don't have to create your own delegates. Use the EventHandler<T> provided with framework. Your code can be written like,
public class Stock {
public event EventHandler<StockArgs> OnAlert;
public event EventHandler<StockArgs> OnVolumeAlert;
public void Alert()
{
if ( OnAlert != null )
OnAlert( this, new StockArgs("ORCL", "14.50", 100000) );
}
}
Best wishes,
Navaneeth
|
|
|
|
|
You have explained such better than me !
|
|
|
|
|
Thanks
Best wishes,
Navaneeth
|
|
|
|
|
anyone knowsw about any other web browser control other than Microsoft?!! I tried searching google but could not found any...
ifyou came across another web browser control,, please let me know...
|
|
|
|
|
|
my application is in C#
|
|
|
|