|
Keshav V. Kamat wrote: just that i need to write the same code for the windows code button, along the maximize and the minimize buttons.
What is the use or writting same code there ? When user clicks windows close button form will close automatically ? Then what's u r prob ?
|
|
|
|
|
Never mind. I got it. Its not as simple as it looks to be.
I wanted to delete all databases created in the project.
Earlier, a separate button used to do the trick.
But if the user fails to click the special button, then the databases wont be deleted, which will in turn pose a problem the next time i run it.
What I mean to say is before the application exits, a series of tasks/events should occur. With the windows default close button, the application simply exists. Hence I wanted to place the code of events over there.
anyways thanks.
Keshav Kamat
India
|
|
|
|
|
Form.Close();
this.WindowState = FormWindowState.Maximized;
this.WindowState = FormWindowState.Minimized;
|
|
|
|
|
thanks got it.
I wanted a series of events to happen when the user clicks the default close button.
We can directly use the form closing event to do the trick.
Keshav Kamat
India
|
|
|
|
|
I'm a beginner. I have a array of form and I want copy some element of this array to other array. I tryed, but when I start debugging, The program has a error. Do you have an other way? Pleased help me!
My code:
...
public static Form[] ListFormFull ={ new Form1(),new Form2(), new Form3(),new Form4()};
public static Form[] listFormChoose;
...
listFormChoose[i]=ListFormFull[j];//Error here
....
Thank you!
|
|
|
|
|
Dothanhnam wrote: public static Form[] listFormChoose;
You are not initializing array try something like
public static Form[] listFormChoose = new Form[4];
|
|
|
|
|
Thank you, but when I rewrite follow you, has a error :Index was outside the bounds of the array. Can you help me!
|
|
|
|
|
This means that the values of i and j that are used as array indexes are getting to big. Arrays have a null-based index, so if your array has four elements those are accessible via indexes 0, 1, 2 and 3.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
I've been making a calculator that i can include in apps that may need one (for convenience)
But ive come accross a slight problem. I have it in hex mode, i type in FF, i use the not operator, i get FFFFFFFFFFFFF00. So all is good.
I do this by converting the hex FF, into a ulong (or UInt64). But when i try to use the NOT again, it goes to FFFFFFFFFFFFFFFF, this is because:
FFFFFFFFFFFFF00 = 18446744073709551360
and NOT 18446744073709551360 = -18446744073709551361
See nows there's the problem, ulong has no negatives. And im way to tired to think anymore. So any unput would be real good. Thanks.
|
|
|
|
|
How are you implementing the not operator?
The following short console program does what you want:
using System;
using System.Collections.Generic;
using System.Text;
namespace NotTest
{
class Program
{
static void Main(string[] args)
{
ulong i = 0xFF;
Console.WriteLine(i);
i = ~i;
Console.WriteLine(i);
i = ~i;
Console.WriteLine(i);
Console.Read();
}
}
}
With the output:
255
18446744073709551360
255
If you're getting negative output, it's gotta be because the unsigned long is being converted to a signed long somewhere along the way.
|
|
|
|
|
Its not my calcy that gave the negative value, that would be the windows calculator.
I'll just see if I can figure it out tomorrow. It's probably something incredible simple.
Well, must sleep now.
|
|
|
|
|
Hello everyone,
I have a String and would like to be able to pick let's say First, Second, and the Last letter and create a new string.
Can someone be kind enough to tell me how I can get this done?
Thank you so much and have a great day.
Khoramdin
|
|
|
|
|
str[0] + str[1] + str[str.Length-1]
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
You can use..
String str = "abc";
foreach (char c in str)
{
// operations on letters.
}
"If our Mind can, the Program can !!"
|
|
|
|
|
Here is code that I found on page 85 of Microsoft Visual C# 2005 Step by Step, I need some further explanation on the line "current = digit + current;" This line seems to concatenate a string and char value, but the book has only a vague exlanation. Could anyone explain further? Here is the code.
#region Using directives
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
#endregion
namespace DoStatement
{
partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void showSteps_Click(object sender, System.EventArgs e)
{
int amount = System.Int32.Parse(number.Text);
steps.Text = "";
string current = "";
do
{
int digitCode = '0' + amount % 10;
char digit = Convert.ToChar(digitCode);
// on first iteration result will be 3,
// but that what current was before adding.
current = digit + current;
steps.Text += current + "\r\n";
amount /= 10;
}
while (amount != 0);
}
}
}
Steven Fried
|
|
|
|
|
netproblemsolver wrote: This line seems to concatenate a string and char value
yes, that's exactly right. You can also add a string and an int, and get a string, the framework works out that this is what you're after.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I’m feeling really stupid. I have to thread a Form (with a webbrowser), then I have to call a save method after a while.
my code...
Namespace MyLib
{
public delegate String DelegateCopyToFile();
public class MyControl
{
public MyWindow MyInterface;
ThreadStart My_start;
Thread MyThread;
…
public MyControl
{
My_start = new ThreadStart(StartBrowser);
MyThread = new Thread(My_start);
MyThread.SetApartmentState(ApartmentState.STA);
MyThread.Start();
}
public void StartBrowser()
{
MyInterface = new MyWindow();
MyInterface.Show();
}
public string SaveNow()
{
return MyInterface.dCopyMyFile();
}
}
public partial class MyWindow : Form
{
public DelegateCopyToFile dCopyMyFile;
public MyWindow()
{
…
dCopyMyFile = new DelegateCopyToFile(this.SaveFile2);
}
public string Namespace MyLib
{
public delegate String DelegateCopyToFile();
public class MyControl
{
public MyWindow MyInterface;
ThreadStart My_start;
Thread MyThread;
…
public MyControl
{
My_start = new ThreadStart(StartBrowser);
MyThread = new Thread(My_start);
MyThread.SetApartmentState(ApartmentState.STA);
MyThread.Start();
}
public void StartBrowser()
{
MyInterface = new MyWindow();
MyInterface.Show();
}
public string SaveNow()
{
return MyInterface.dCopyMyFile();
}
}
public partial class MyWindow : Form
{
public DelegateCopyToFile dCopyMyFile;
public MyWindow()
{
…
dCopyMyFile = new DelegateCopyToFile(this.SaveFile2);
}
public string SaveFile2()
{
…
}
}
}
Everything works fine till SaveFile2. There the webbrowswer throws an exception:
“COM object that has been separated from its underlying RCW cannot be used”
I’m running .net 2.0 and the only fix I can find is
http://support.microsoft.com/kb/818612/
When I install it says, “You already have this installed”.
There are some issues with Marshall but I’m not using that.
Any leads would be helpful.
Thanks
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
Hi
How to make phone call with or without c# with small amount of code????
thx
nemanja
|
|
|
|
|
I need something like an enumeration of classes.
<br />
class Garage{<br />
<br />
public static Car Ford = new Car (.....);<br />
public static Car Chevy = new Car (.....);<br />
public static Car Subaru = new Car (.....);<br />
public static Car Mazda = new Car (.....);<br />
<br />
}<br />
then do something like
<br />
foreach(Car x in Garage){<br />
...<br />
...<br />
}<br />
<br />
Funny thing: By force of habit, I hit F6 after I typed this..;P
|
|
|
|
|
Use a collection.
public static Car = nll;
ArrayList list = new ArrayList();
Ford = new Car (.....);
list.Add(Ford);
foreach(Car c in Garage)
.......
Mike
If you keep doing what you've been doing you'll keep getting what you've been getting!
|
|
|
|
|
Mike Hankey wrote: ArrayList list = new ArrayList();
But only in C# 1.1, otherwise, use generic collections.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Yes..Thank You
I'm still converting from VS2002 to VS2005 , its taking awhile?
Mike
If you keep doing what you've been doing you'll keep getting what you've been getting!
|
|
|
|
|
dino2094 wrote: public static Car Ford = new Car (.....);
public static Car Chevy = new Car (.....);
public static Car Subaru = new Car (.....);
public static Car Mazda = new Car (.....);
Wouldn't it make more sense to have a collection of car types, as derived classes ? Can't you ever have more than one Mazda in your garage ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: Can't you ever have more than one Mazda in your garage ?
Or even more than one Mazda in all garages (note, he's declared them as static )
|
|
|
|
|
Hi people
I am am making a small app where i want to upload report from ado.net access database to internet;
How to do that??
It isn't matter if it is mysql or ...
nemanja
|
|
|
|