|
All numbers are fixed sizes except IntPtr.
|
|
|
|
|
Cool, leppie!
Question answered.
regards,
George
|
|
|
|
|
Hi,
How to move all items(not selected) in a listbox to a string array??
i want to move items in a listbox to a string array.How can i do that??
Plz help..
regards,
syamoooo
|
|
|
|
|
Use a foreach loop on the items in your listbox and add the ones that are not selected to a List<string> (provided you're using .NET 2.0 and above)
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
Hi all,
In my application i have 5 forms. I would like to store some value in global varialble which can access by any forms in my app.I have try to create a get/set class and i declare a public object in form let said form A. But i can't access the object in form B. My example coding as below:
Class GetSet:
private String _name;<br />
public String name<br />
{<br />
get{return _name;}<br />
set{_name = value;}<br />
}
FormA:
public partial class FrmA : Form<br />
{<br />
GetSet gs;<br />
public FrmMain()<br />
{<br />
gs = new GetSet();<br />
gs.name = "cocoon";<br />
}<br />
<br />
}
FormB:
public partial class FrmB : Form<br />
{<br />
GetSet gs;<br />
public FrmMain()<br />
{<br />
console.write(gs.name);<br />
}<br />
<br />
}
Can anyone guide me to slove this out.
thanks in advance
regards
cocoon
|
|
|
|
|
You have to rethink your design.
cocoonwls wrote: How to create global variable
You can't. However, you can create a static class which is quite similar to what you are asking for. There are plenty of examples on Google.
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
The way to do this, is to use delegates, or create a class with static properties. If you thought that FrmB would do anything but crash, or had any chance of seeing hte value 'cocoon', you need to do some serious reading on OO, because you've misunderstood quite a bit.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi Vikram and Christian,
Thanks for your reply. I have read through the static class and it useful to me. Then, Christian Graus, can you please explan a bit more to me why would you said i am misunderstood OO concept?
Thanks in advance.
regards
cocoon
|
|
|
|
|
You can use singleton class object. It will help in state maintainance in the application.
Sarvesh Upadhyay
Senior Software Engineer
Birlasoft India Ltd.
Microsoft Certified Professional Developer in Dotnet 2.0 Enterprise Application
|
|
|
|
|
Hi,
I'm working on an tiny application with an MySql Server and 2 buttons and 2 textbox,
The idea is that when i fill in the 2 textbox and press one of the buttons i add an entry to my Database(located on an external host)
i've been reading this article:
http://www.codeproject.com/KB/database/MySQLCsharp.aspx[^
But i'm still not clear on how to get it done.
I could use any advise/code snippets.
Thanks in advance
Ben
|
|
|
|
|
That article looks pretty good to me, what exactly are you struggling with? I presume you've downloaded the .NET connector and included it in your project?
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
Yes i have,
and now when i try to use my DataGridView and use the MySql (external located) i wont connect to it,
it always gives error message that it cannot connect to the server/database
|
|
|
|
|
OK, well it would help a lot if you could post some relevant code snippets, specifically the section where you create your MySqlConnection object, attempt to connect etc.
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
bdiepeveen wrote: it cannot connect to the server/database
If you have a client tool of mySql, did you try connecting using that? This is to verify if the server is up and running, accepting connections from the specified hosts and there is no intermediate firewall software peeking into and 'eating away' the packets.
If your system has a Php, then you can try using PhpMyAdmin (http://phpmyadmin.sourceforge.net/[^]). It is a web-based frontend for MySQL database.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
bdiepeveen wrote: MySql (external located)
If your MySQL server is running on a remote machine, you will have some permission issues. By default MySQL uses port 3306 to listen. You need to ask your server providers to change the firewall settings which allows connections from outside to this port. You may try to install MySQL GUI tools and connect to the server. This will give you exact error message.
|
|
|
|
|
I got the connection working now,
And it reads the data with out problems,
now my questions is i got 3 buttons and 2 txt boxes,
What i want is when i enter some text into the txtboxes and i press the add button it adds the information into the database, same goes for the remove button that i can select an item from my DataGridView and remove it, I've also got an refresh button planned wich can be used to refresh the database to check for any changes.
My questions about this is if i should be using the IbidingList or can i work from here on,
the code for the filling the datagridview looks as follows:
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'pksolution_benDataSet.facturen' table. You can move, or remove it, as needed.
this.facturenTableAdapter.Fill(this.pksolution_benDataSet.facturen);
}
It loads upon starting the application
Any help advise or books i could use are apriciated
Greetings
Ben
|
|
|
|
|
The communication between the Database is done now ,
Tough i'm having trouble with the getting the information to be displayed inside the DataGridView
i cannot use the dgvContent.Datasource = *databindingsource*.load; so thats out of the question.
for now i got exually no code sinds all my attempts have failed or resulted in empty DataGridView
I could use any help or suggestions or even books you can advise me on
Thanks in advance Ben
|
|
|
|
|
Ok so I'm constantly having problems with parameters that magically disappear when changing to a hard coded query. Should I switch back o using hard coded queries?
|
|
|
|
|
I don't think anyone has a clue what you're talking about.
What do you mean by "when changing to a hard coded query" and "parameters that disappear"??
|
|
|
|
|
Hi all,
i have an string of date like xx="4/14/2008";
when i am trying to convert it into date time by
System.IFormatProvider frmt = new System.Globalization.CultureInfo("en-US", true);
DateTime dt32 = DateTime.ParseExact(xx, "MM/dd/yyyy", frmt);
it is giving me dt32 as dt32 = {4/14/2008 12:00:00 AM}
in above case i dont want to have "12:00:00 AM" part can u please help me.. here
i tried to parse like this also..
DateTime.TryParse(xx, out MyDateTime1);
it also didnt help me here..
Please help me
Thanks alot in advance...
vikas da
|
|
|
|
|
tasumisra wrote: it is giving me dt32 as dt32 = {4/14/2008 12:00:00 AM}
The time part is always stored; it's not called a DateTime for no reason. You can suppress it when you display it by calling the ToString() overload, however.
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
i have to perform comaprision of date without time
coz if time is there then some time my condition will fail as an exaple
if (mydatetime4.Date >= dt12.Date && dt12.Date >= MyDateTime2.Date)
so in above
if mydatetime4.Date =4/14/2008 11:30:00 am
and dt12=4/14/2008 12:00:00 Am
that time definitly it will fail but i do not have to care abt the time if date matches then i have process some code..
please help me here ..
vikas da
|
|
|
|
|
This will work:
if (mydatetime4.Date.ToShortDateString() >= dt12.Date.ToShortDateString() && dt12.Date >= MyDateTime2.Date.ToShortDateString())
My idea of ideal life : Eat, Sleep, Repeat
|
|
|
|
|
sorry sir .. it wont work coz in this case date are in string formate ... and we cant compare string like <= operator here....
vikas da
|
|
|
|
|
My mistake. This works for me.
string xx = "04/14/2008";<br />
System.IFormatProvider frmt = new System.Globalization.CultureInfo("en-US", true);<br />
DateTime dt32 = (DateTime.ParseExact(xx, "MM/dd/yyyy", frmt));<br />
<br />
DateTime dt33 = new DateTime();<br />
dt33 = Convert.ToDateTime(xx);<br />
dt33 = dt33.AddHours(1);<br />
if(dt33.Date == dt32.Date) {<br />
string s = "";<br />
}<br />
}
My idea of ideal life : Eat, Sleep, Repeat
|
|
|
|