|
How rude putting urgent in your subject line.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Hi all,
I am creating an website using AJAX, When the user close the browser by clicking the X button in right top, i want to call an javascript function, this function calls an asp.net page using AJAX, In that asp.net page i am doing some database related operations.
My doubt is when i close the browser the asp.net page is called and closed suddenly, I cant able to call the method in that asp.net page.
How to solve this problem, plz any one suggest me.
Thanks in advance
Know is Drop, Unknown is Ocean
|
|
|
|
|
I want to export my gridview data to excel, want to place each column of a row in gridview on to the text box by placing text box on the excel cell.
Thanks!
KU
|
|
|
|
|
string seth;
bool anm, beh, st, en;
StreamReader a = new StreamReader(".\\Format.cfg");
while (a.Peek != -1)
{
seth = a.ReadLine;
if (seth.Trim.Length != 0)
{
if (seth.Trim = "ABC")
{
anm = true;
}
else if (seth.Trim = "XYZ")
{
st = true;
}
}
}
these codes look pretty but have 5 errors
1.Operator '!=' cannot be applied to operands of type 'method group' and 'int'
2.Cannot convert method group 'ReadLine' to non-delegate type 'string'. Did you intend to invoke the method?
3.'string.Trim(params char[])' is a 'method', which is not valid in the given context
4.Cannot assign to 'Trim' because it is a 'method group'
5.Cannot assign to 'Trim' because it is a 'method group'
i tried lots of times and did as i could
i hope here is someone who can solve it
thanks
|
|
|
|
|
The bold items are the one's I've added/changed.
string seth;
bool anm, beh, st, en;
StreamReader a = new StreamReader(".\\Format.cfg");
while (a.Peek() != -1)
{
seth = a.ReadLine();
if (seth.Trim().Length != 0)
{
if (seth.Trim() == "ABC")
{
anm = true;
}
else if (seth.Trim() == "XYZ")
{
st = true;
}
}
}
|
|
|
|
|
Could it be that you're usually using VB?
In C# you have to write '(' and ')' even for an empty method parameter list (Peek, ReadLine, Trim).
And '==' is the comparison for equality whereas '=' is reserved for assignments only.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
yep, first i used VB but now i m new in C#
anyway thanks buddies but it still have 4 errors
string seth;
bool anm, beh, st, en;
StreamReader a = new StreamReader(".\\Format.cfg");
while (a.Peek() != -1)
{
seth = a.ReadLine();
if (seth.Trim().Length != 0)
{
if (seth.Trim() = "ABC")
{
anm = true;
}
else if (seth.Trim() = "XYZ")
{
st = true;
}
}
}
1.The left-hand side of an assignment must be a variable, property or indexer
2.Cannot implicitly convert type 'string' to 'bool'
3.The left-hand side of an assignment must be a variable, property or indexer
4.Cannot implicitly convert type 'string' to 'bool'
|
|
|
|
|
= is the assignment operator. == is the comparison operator.
--
You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer
|
|
|
|
|
hehe, its working, thanks
|
|
|
|
|
i have a new question that how can i compare bool
for instance
bool as;
if (as=true);
{
}
if i use == instead of = then its giving error
thats my question...
|
|
|
|
|
You compare bools by using the == operator. The = operator is the assignment operator, e.g. a = b means a gets the value of b. The == operator is the equality operator.
If you looked at my earlier answer, you would see that I amended your code to use == instead of = in all the places you had the wrong one (Unfortunately, the bold option didn't seem to show them too well).
|
|
|
|
|
yep i tried first == but it gave error, then i tried with = but it assign it to true
then i post here and when noone reply here then i thought i should do that myself and i read error but all bounce on me,but i read read read
and got the problem, that was i assign 3 bools in a line
my problem solved....!!
Becoming Programmer...
|
|
|
|
|
Hi ALL,
How is it possible to Load a DLL at run time.. . And then load a method from that DLL .. .
SHould i use Reflection concept here ... plz explain???
|
|
|
|
|
|
Thanks for the help .. .
I found my answer in
http://my.execpc.com/~gopalan/dotnet/reflection.html[^]
hmm . .. I searched for the following in GOOGLE
- > dynamically import dll in C#
- > call a method dynamically in C#
but your search string was "APT"
- > c# dynamically load method
|
|
|
|
|
It can be a pain getting the right search keywords. I always put C# first as it's the most relivent keyword.
|
|
|
|
|
I want to download all files from a certain FTP folder to a folder on local machine. I am using C#.NET. Is there anyone to give me any idea how to do that? If someone have code to do that, plz upload it.
Thanks
|
|
|
|
|
|
the link contains a demo which uses the FTPWebRequest class. I want to build a console application not a web application. Can anyone else tell me how to implement this functionality in a window console application usin C#
|
|
|
|
|
This is just an example that shows you how to use FtpWebRequest class. This class does not require the use of a Web application.
-----
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
|
Hi all,
I'm starting my app (.NET1.1), celebrating good practice, with an info form, which contains nothing but a picturebox and a timer which closes the window after 3 sec. not more. 1000 times it works without problems but sometimes I get the following exception. How do I have to handle such exception ? I have no idea ?
System.TypeInitializationException: Der Typeninitialisierer für System.Drawing.SafeNativeMethods hat eine Ausnahme verursacht. ---> System.Threading.ThreadAbortException: Der Thread wurde abgebrochen.
at System.Drawing.SafeNativeMethods.GdiplusStartup(IntPtr& token, StartupInput& input, StartupOutput& output)
at System.Drawing.SafeNativeMethods.Initialize()
at System.Drawing.SafeNativeMethods..cctor()
--- Ende der internen Ausnahmestapelüberwachung ---
at System.Drawing.SafeNativeMethods.CreateIconFromResourceEx(Byte* pbIconBits, Int32 cbIconBits, Boolean fIcon, Int32 dwVersion, Int32 csDesired, Int32 cyDesired, Int32 flags)
at System.Drawing.Icon.Initialize(Int32 width, Int32 height)
at System.Drawing.Icon..ctor(SerializationInfo info, StreamingContext context)
at System.Drawing.SafeNativeMethods.CreateIconFromResourceEx(Byte* pbIconBits, Int32 cbIconBits, Boolean fIcon, Int32 dwVersion, Int32 csDesired, Int32 cyDesired, Int32 flags)
at System.Drawing.Icon.Initialize(Int32 width, Int32 height)
at System.Drawing.Icon..ctor(SerializationInfo info, StreamingContext context)
IntPtr CreateIconFromResourceEx(Byte*, Int32, Boolean, Int32, Int32, Int32, Int32)
Thank's for help
Frank
fracalifa
|
|
|
|
|
Insufficient data, you might want to show the code.
Wild guess: you did use a timer other than Forms.Timer, and its handler
is performing an Illegal Cross-Thread operation on a control (probably the InfoForm itself).
If correct, the remedy is either use Forms.Timer or read up on Control.Invoke
|
|
|
|
|
Here is the code ... nothing spectacular
public class Info_Start : System.Windows.Forms.Form
{
private System.Windows.Forms.Timer timer1;
private System.ComponentModel.IContainer components;
public Info_Start()
{
InitializeComponent();
timer1.Interval = 5000;
timer1.Start();
this.TopMost=true;
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Info_Start));
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.ClientSize = new System.Drawing.Size(512, 360);
this.ControlBox = false;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(520, 368);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(520, 368);
this.Name = "Info_Start";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.TopMost = true;
this.Click += new System.EventHandler(this.Info_Start_Click);
this.Activated += new System.EventHandler(this.Info_Start_Activated);
}
#endregion
private void timer1_Tick(object sender, System.EventArgs e)
{
this.Close();
}
private void Info_Start_Click(object sender, System.EventArgs e)
{
this.Close();
}
}
}
that's all ...
|
|
|
|
|
fracalifa wrote: nothing spectacular
I agree.
Looks fine at first glance.
Now my guess is, when it fails, it is the timer firing before the form has been completely
loaded (i.e. in the middle of loading the icon, see StackTraceBack).
Remedy might be: wire a Load event and use it to start your timer.
|
|
|
|