|
keeps throwing
-- line 10 col 1: VB does not support anonymous methods/lambda expressions with a statement body
thanks
|
|
|
|
|
I guess you have to implement this part in a different way then
|
|
|
|
|
|
here is how you convert it
Private bytesUploaded As Long
Public Property BytesUploaded() As Long
Get
Return bytesUploaded
End Get
Set
bytesUploaded = value
Me.Dispatcher.BeginInvoke(Function() Do
If PropertyChanged <> Nothing Then
PropertyChanged(Me, New PropertyChangedEventArgs("BytesUploaded"))
End If
End Function)
End Set
End Property
and here is the Best Site for Converting
http://converter.telerik.com/[^]
Kind Regards
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hello and thanks for your reply
This lambada expression (do) is killing me
here is what i got so far
Private m_bytesUploaded As Long
Public Property BytesUploaded() As Long
Get
Return bytesUploaded
End Get
Set(ByVal value As Long)
Me.Dispatcher.BeginInvoke(Function() do(If PropertyChanged <> Nothing Then PropertyChanged(Me, New PropertyChangedEventArgs("BytesUploaded"))End If)) End Function)
End Set
End Property
Please help
/
|
|
|
|
|
You've been told already to please put your code in pre tags, it makes it much more readable.
|
|
|
|
|
webspeed wrote: If PropertyChanged <> Nothing Then PropertyChanged(Me, New PropertyChangedEventArgs("BytesUploaded"))End If
For a start, your code is easier to read in pre tags. As for your problem, you could replace that if-clause with a simple RaiseEvent EventName(EventArg1, EventArg2)
|
|
|
|
|
Hi Experts
I Have a Window Application in .net 2.0 and sql server 2005.
when user login the application at one terminal then same user not login
in the other terminal.
I Have done this by maintain one table in sql server like
user Status
A 1 //Active
B 0 //passive
when user close application then Status set to 0(passive) of Active user.
but the issue rise when system shutdown without closing application.or
the person can close application from window tasklist.
then how i can solve this problem.
Thank U
Dinesh Sharma
|
|
|
|
|
In the login form itself, attach an handler for Applciation.Exit event. When you quit the applcation, from any form and through Task manager as well, this event will be fired. There you can set the flag to zero again.
Although you wont be able to do much about shut down though. Hence if the last login of the user was some X - minutes before, let the user login. Also, in this case, you will need to update the database with user's login details at regular intervals to handle following case:
Say if a user opened your application and has not done anything for 30 min. And you have set that X minutes as 15, then his connection is gone. So you will need to regularly update the database, maybe on another thread, that user has not closed the application yet and is doing something.
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...!!
|
|
|
|
|
Hello,
I have an app that use an excel component(ocxt.com). This component have a strange behavior, which I reproduced it with Interop.Excel.
Bellow is the functions with I open and close an excel file programatically:
private ApplicationClass app = null;
private Workbook book = null;
private Worksheet sheet = null;
...
private void openExcel(string fileName)
{
if (app != null)
closeExcel();
app = new ApplicationClass();
app.Visible = false;
app.ScreenUpdating = false;
app.DisplayAlerts = false;
book = app.Workbooks.Open(fileName, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Missing.Value);
sheet = (Worksheet)book.Sheets[1];
}
void closeExcel()
{
if (sheet != null)
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(sheet);
sheet = null;
}
if (book != null)
{
book.Close(false, Missing.Value, Missing.Value);
System.Runtime.InteropServices.Marshal.ReleaseComObject(book);
book = null;
}
if (app != null)
{
app.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(app);
}
app = null;
GC.Collect();
}
If I have 2 files: 1.xls and 2.xls and 1.xls I always open with .net code, and 2.xls double clicking it. There is 2 undesired (for me) behaviors:
1. If I open first by code file 1.xls, and then try to open 2.xls from Windows Explorer, 2.xls doesn't open. It only open an inactive Excel.
2. When I close by code 1.xls, it close 2.xls too.
What I do wrong?
Thank you.
|
|
|
|
|
I have had similar problems while using Word interop.
I found a post somewhere(not sure where) that mentioned creating 2 instances of the application object and then only using the second one in your program.
It worked for me, try it out.
|
|
|
|
|
Thank you for a such quick response.
It works, but not as I want. When I close first instance, it close also the other excel opened.
So, I have 2 possibilities:
1. to close first instance (it close other excel file too);
2. or, not close, but may be remain excel processes zombie.
|
|
|
|
|
Make sure the excel you are openning through code runs as a separate process. And while closing things, only close that particular process.
Also, GC.Collect use is not recommended.
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...!!
|
|
|
|
|
I don't know how to open an excel through code in a separate process.
|
|
|
|
|
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");
|
|
|
|