|
|
or ToString("D6");
analogous to ToString("X8"); for hex
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I was sure it was simple, but is soooo simple that I'm feeling embarrased
Regards,
Diego F.
|
|
|
|
|
This is a newbie question:
I have read lots of tutorials on how to add a datasource to project.
How to I cleanly remove a datasource or databindings from a project?
This has been a real pain for me. I have to spend a lot of time manually going through code to make sure all the references to these deleted form objects are removed.
Whats the best way?
TIA,
shwa guy.
|
|
|
|
|
The best way? You're already doing it. Since the designer cannot know what impact removing all of the references to the dataset would have on your code, it just doesn't touch it.
The absolute best way is to plan your data model more carefully so your not deleting datasources all the time.
|
|
|
|
|
Is there a way to suspend a thread until an event is triggered?
|
|
|
|
|
The System.Threading namespace contains some classes for thread synchronization.
e.g. ManualResetEvent.WaitOne()
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi,
I have some Form ( WinForm ) that on him i have button "Help".
I want to make the keyboard button F1 enable and in case that the application user will press on the F1 => then the help button will be press / or the some method in my application will be call.
How to do it ?
Thanks for any help.
|
|
|
|
|
Yanshof wrote: have some Form ( WinForm ) that on him i have button "Help".
You can set short cut key for that menu as F1. Then menu code will be called
|
|
|
|
|
Ok, And how do i do it ?
Is there is some other way ?
|
|
|
|
|
Create a new form - This form will be the help window.
Now, click in the main form, and set it's KeyDown event.
Write the following code in the event handler:
if (e.KeyCode == Keys.F1)
{
HelpForm helpForm = new HelpForm();
helpForm.ShowDialog();
}
If your help form isn't called 'HelpForm' then write the correct name instead of.
Virtual1ty
"Any fool can learn from his own mistakes, but a wise man learns from mistakes of others"
|
|
|
|
|
Just handle Form.HelpRequested event
Edit: If ya want to have a "question mark"-button in the top-right corner, set HelpButton property to true and both MaximizeBox and MinimizeBox to false;
-- modified at 11:50 Tuesday 25th September, 2007
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
Why not add a System.Windows.Forms.HelpProvider by dropping one onto your form, set its HelpNamespace to the .chm file you want to open and then in your form's properties, set the HelpKeyword and HelpNavigator properties?
the Visual Studio 2005 documentation has an example in C# for the HelpProvider class.
Good Luck!
It isn't enough to do well in life.
One must do good when and where one can.
Otherwise, what's the point?
|
|
|
|
|
How can I make the Label to be a fixed width and span more than one row?
_____________________________
...and justice for all
APe
|
|
|
|
|
Set property AutoSize to false
|
|
|
|
|
Pls i want to use the getdate() sql method to get time insert it into sql database and make sure that the column in the database is always reading the current time.That means it may have to update the time every second.How do i do this?
IT'S GREAT TO BE HERE
|
|
|
|
|
You've already asked this question on the SQL forum.
What has this got to do with C#?
Paul
|
|
|
|
|
Hello
I make a form, where i choose the server and the database
- How can i get all the database in the specific serveer that i choose ?
Thanks a lot
Assaf
|
|
|
|
|
Query the table sysdatabases in the master database (which is always available if the user has sufficient permission)
Please vote my message! Click on one of the numbers beside ' Rate this message'.
.: I love it when a plan comes together :.
http://www.zonderpunt.nl
|
|
|
|
|
how i can do that please !
Thanls a lot
Assaf
|
|
|
|
|
I didn't try it, but this should be it:
private bool GetTables()<br />
{<br />
try<br />
{<br />
SqlConnection dataConnection = new SqlConnection();<br />
dataConnection.ConnectionString = ConnectionString;<br />
dataConnection.Open();<br />
SqlCommand dataCommand1;<br />
SqlDataReader dataReader1;<br />
<br />
dataCommand1 = new SqlCommand();<br />
dataCommand1.Connection = dataConnection;<br />
dataCommand1.CommandText = "SELECT Name FROM [Master].[dbo].[sysdatabases]";<br />
dataReader1 = dataCommand1.ExecuteReader();<br />
<br />
while (dataReader1.Read())<br />
{<br />
Console.WriteLine(dataReader1.GetValue(0));<br />
}<br />
dataReader1.Close();<br />
dataCommand1.Dispose();<br />
dataConnection.Close();<br />
<br />
return true;<br />
}<br />
catch (Exception ex)<br />
{<br />
Console.WriteLine("Error - Tables " + ex.Message);<br />
return false;<br />
}<br />
}
|
|
|
|
|
Hi guys,
I need some help pretty urgently please...
I'm using a console application (C#) to clear emails out of the Deleted Items folder on a outlook app running on a server - keeping the latest 300 mails. That part works fine - I created the application class, namespace (MAPI), folder and explorer for this instance - the first problem I have is, clearing the Deleted Items folder works, but how do I move from the Deleted Items folder to a user created folder called 'test'?
Secondly, how do I move between multiple mailboxes within the same outlook instance?
Any help would be greatly appreciated!
Thanks!
|
|
|
|
|
Hi,
I'm trying to write the data in the dataset to Excel. Following is my code snippet:
Excel.Application xlApp;
Excel.Workbook xlBook;
Excel.Worksheet xlSheet1;
public void ToExcel(DataSet M_Dataset)
{
object oMissing=System.Reflection.Missing.Value;
try
{
DateTime dt1=DateTime.Now;
string GetCurrentDate="";
string strFilePath = string.Empty;
GetCurrentDate=dt1.ToString("ddMMMyy");
//Start Excel, and then create a new workbook.
xlApp = new Excel.ApplicationClass();
xlBook = xlApp.Workbooks.Add(Missing.Value );
xlSheet1 = (Excel.Worksheet)xlBook.Worksheets.get_Item(1);
xlSheet1.Name = "FinalBonds_"+"_"+GetCurrentDate ;
EventDel_BeforeBookClose =new Excel.AppEvents_WorkbookBeforeCloseEventHandler( BeforeBookClose)
xlApp.WorkbookBeforeClose += EventDel_BeforeBookClose;
//Add an event handler for the Change event of both worksheet objects.
EventDel_CellsChange = new Excel.DocEvents_ChangeEventHandler( CellsChange);
xlSheet1.Change += EventDel_CellsChange;
System.Data.DataTable xlsTbl=M_Dataset.Tables[0];
int ColumnIndex=0;
foreach(DataColumn col in xlsTbl.Columns)
{
ColumnIndex++;
xlSheet1.Cells[1,ColumnIndex]=col.ColumnName;
//((Range)xlSheet1.Cells[1,ColumnIndex]).EntireRow.Font.Bold=true;
//((Range)xlSheet1.Cells[1,ColumnIndex]).Columns.AutoFit();
}
int rowIndex=0;
foreach(DataRow row in xlsTbl.Rows)
{
rowIndex++;
ColumnIndex=0;
foreach(DataColumn col in xlsTbl.Columns)
{
ColumnIndex++;
xlSheet1.Cells[rowIndex+1,ColumnIndex]=row[col.ColumnName];
}
}
errMessage="Sucessfully written records in Sheet 1.";
//cfg.LogMessage(errMessage);
strFilePath = @"C:\Projects\LiquidCreditChains\LIQReports\FinalUniverseBonds.xls";
xlBook.SaveCopyAs(strFilePath);
}
catch(Exception ex)
{
string strErrMsg = string.Empty;
strErrMsg = ex.Message;
}
}
I'm getting the error message as "Exception from HRESULT: 0x800A03EC.". I don't know what it means. Please help. Please let me know if you require further information to resolve the issue.
The dataset contains 40 columns and 4500 rows.
Thanks,
-- modified at 7:59 Tuesday 25th September, 2007
Meeram395
|
|
|
|
|
Good Afternoon
I have a button sitting on form1 and i would like form2 to trigger that button
How do I go about doing that:
in form1 i just say button1.PerformClick();
and it works however I would like to call the event using form2
|
|
|
|
|
Assuming that form2 has a reference to form1, then you can simply create a public method to perform the click.
public void ClickButton() {
button1.PerformClick();
}
form1.ClickButton();
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|