|
$user="UsernameForYourMySqlDB";
$pass="PasswordForYourMySqlDB";
$db="YourDB_Name";
$link=mysql_connect("localhost",$user,$pass);
if(!$link)
die("Couldnt connect to MySQL");
mysql_select_db($db,$link) or die ("couldnt open $db: ".mysql_error());
print "connected to $db";
CheeN
|
|
|
|
|
How can I rename a file? what i am doing is copying a file from it's source to a certain directory. Now I want to rename the file name in the destination folder. How can I do that?
Thanking in advance.
|
|
|
|
|
|
I've done some looking around and I'm a bit confused
Here is an example of the data that's in the binding source
[IMG]http://i38.tinypic.com/xfoimp.png[/IMG]
what i want to do is sort on the 3rd row ( 4 or 3) and then sort by the date ( to see if the record is before a certian time
my idea to do this was to
filter the BS
BS.count
then unfiltered the BS
The problem i keep running into is that i cant say that i want Just 4 or Just 3
What I've come up with so far is
private int deadlineCount(DateTime Time, int LeagueID)
{
int total = 0;
string league;
if (LeagueID == 99)
{
league = "";
}
else
{
league = LeagueID.ToString();
}
BS.Filter = string.Format("LeagueID >= '{0}' and LeagueID <= '{0}'and [End] <#12/30/1899 {1}#", league, Time.ToString("h:mm tt"));
total = BS.Count;
BS.Filter = "";
return total;
}
But i keep running into problems that i cant use any operator ( like ,> ,= ,>=,) becuase it can not preform X onn system.int32 and system.string.
I've been looking around but all the example seem to be for strings or dates.
|
|
|
|
|
hi, i have a timer which call this method CalPrice().
The calprice will check the dategridview first column if the checkbox ==true, then calculate the price base on the the other column
private void CalPrice()
{
double price = 0.0;
foreach (DataGridViewRow dgw in dataGridProduct.Rows)
{
DataGridViewCheckBoxCell datacell = dgw.Cells[0] as DataGridViewCheckBoxCell;
try
{
if ((bool)datacell.Value == true)
{
price += Convert.ToDouble(dgw.Cells[6].Value.ToString());
}
lblTotalPrice.Text = "Total Price : $ " + price;
}
catch (Exception exc)
{
}
}
private void timer1_Tick(object sender, EventArgs e)
{
CalPrice();
}
}
I have set the timer to enable and interval to 1000(1 second). But when i load the form, the timer dont seems to start. It does not call the calPrice method
|
|
|
|
|
Hi!
Did you debug or are you just assuming that CalPrice is not being called?
If you're simply swallowing any exception that's being thrown, you can come to false conclusions.
Apart from that you either didn't assign an event handler for Tick or you didn't start the timer - not much else that can go wrong. Timers work just fine for a lot of people out there, you know...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
which event should i use to check if the column is tick or untick in a datagrid.
i tried cell_click but after i tick a checkbox, i have to click OUt of the datagrid, then it will populate the price
|
|
|
|
|
Maybe grid's CellValueChanged event - in the event arguments you get the index of the edited row and column index as well..
it's called when the value is commited ex. when the editmode is set to 'doubleclick or f2' [entar] commits value change.
also when you use Convert.To... you don't have to use ToString() on the converted object.
life is study!!!
|
|
|
|
|
I want to know how to create a simple program that can print data using PRINTER CLASSES(if any) of C#?..
|
|
|
|
|
I am not clear about ‘Printer Classes’, however printing can be done using PrintDocument and Print Preview control.
In case if you need to access printer settings you may do so by accessing System.Drawing.Printing.PrinterSettings class items.
-Dave.
------------------------------------
http://www.componentone.com
------------------------------------
|
|
|
|
|
hmmm.. interesting... i'm trying to create my own text editor and should have the print feature.. am guessing maybe someone has already coded it so that i could just refer to the code. any tutorials or resources you have that could help?
|
|
|
|
|
hi,
i design a application that opens a form from other form, i use the ".showdialog" ".show" methods that works fine.
but a also want to close the first form when the second form loads, but i can´t manage to do that.
when i trie to do that i shutdown the all application or something else!!!
thanks!!!
|
|
|
|
|
The logical thing to do here is to make both forms laid out on user controls, then show them both in the one form.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
You may hide the first form (Closing your start up form will close the application).
Also code will stop executing at the call ".ShowDialog()", and will only continue after the user has closed the second form.
|
|
|
|
|
Hi,
How can i trigger an event when the user presses the cancel button [X] on the title bar? i want the application to perform a final task before it goes off!
|
|
|
|
|
You mean the Form's Closing event?
|
|
|
|
|
it´s to manage a login/logout process!
I prefer that the user uses the logout button, but sometimes the user shotdown the application or it goes down.
I already have a store procedure for all that but, like i said, sometimes i can´t get logout info.
yes, a form closing or application closing event i think!
|
|
|
|
|
Form.FormClosing
and maybe FormClosingEventArgs.CloseReason
|
|
|
|
|
nelsonpaixao wrote: or it goes down
There's nothing you can do about a system crash or the user terminating the app via Task Manager.
I use a FormClosing event handler to do cleanup like that.
The handler for a Close button simply calls this.Close()
|
|
|
|
|
Then have the FormClosing handler call the Logout handler.
|
|
|
|
|
Hi,
how can i set the color for the title bar? i can´t change it, it´s always blue!
the tagcontrol too!!!
modified on Wednesday, July 9, 2008 9:00 PM
|
|
|
|
|
Hi,
either change Windows appearance/theme for the entire system,
or use a borderless Window and draw a fake border yourself.
|
|
|
|
|
I believe you need to make them owner drawn and draw them yourself.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
You can't change the color of the titlebar without changing aspects of the visual style of the system or creating a new layout on a borderless form. If you would like to customize (add buttons, etc to the titlebar) or alter the tabcontrol appearance, I will point you to two of my articles:
Add Transparent Menus and Windows Titlebar Buttons to your Application[^]
ToolStrip Custom Renderers[^]
Regards,
Thomas Stockwell
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.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
Hey guys,
I been trying to update my Listbox Control from importerCollection with no luck(importerCollection -class derived from List<importer>) .
Everytime I update/add item to my list, the LoadImporters() Method runs.
The problem is that it doesn't update my Listbox Control,
I been trying to use the Listbox.Refresh Method which didn't really worked.
The Only thing which worked is creating a new instance of ImporterCollection and settings the
Listbox datasource to this new instance.
I don't see any reason creating a new instance of it everytime I want to update/add Item in my List, it suppose to get update automatically.
I also have another problem, I dont know how to set the Databindings to update automatically. I think this problem might be the solution for the first problem
I will glad to hear some solutions to my problems. Thank you very much!
ImporterCollection importerCollection = new ImporterCollection();
public FormManageImporters()
{
InitializeComponent();
LoadImporters();
SetDataset();
SetBindings();
}
private void LoadImporters()
{
importerCollection.FillImporters();
}
private void SetDataset()
{
listBoxImporters.DataSource = importerCollection;
listBoxImporters.ValueMember = "ImporterID";
listBoxImporters.DisplayMember = "ImporterName";
}
private void SetBindings()
{
textBoxPhone.DataBindings.Add("Text", importerCollection, "Phone");
textBoxAlternativePhone.DataBindings.Add("Text", importerCollection, "AlternativePhone");
textBoxCellularPhone.DataBindings.Add("Text", importerCollection, "CellularPhone");
textBoxFax.DataBindings.Add("Text", importerCollection, "Fax");
}
private void Importer_Changed(object sender, EventArgs e)
{
LoadImporters();
}
private void buttonAdd_Click(object sender, EventArgs e)
{
FormImporter formImporter = new FormImporter();
formImporter.ImporterChanged += new FormImporter.ImporterChangedEventHandler(Importer_Changed);
formImporter.Show();
}
|
|
|
|