|
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
|
|
|
|
|
I understand that but how would i reference it
|
|
|
|
|
Check out Martin#'s response and reply back if that doesn't help.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Hello,
This article[^] from Colin, gives you all you need!
All the best,
Martin
|
|
|
|
|
In VS 2003 i've used Datagrid and code bellow but in VS 2005 I use gridView but don't know how to change the code to VS2005(Gridview format). I'm new in VS 2005.Somebody help me pleaes...
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace Webtest
{
///
/// Summary description for WebForm12.
///
public class WebForm12 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid DataGrid1;
DataTable dt;
private void Page_Load(object sender, System.EventArgs e)
{
dt = new DataTable();
dt.Columns.Add("this");
dt.Columns.Add("is");
dt.Columns.Add("a");
dt.Columns.Add("test");
DataRow dr = dt.NewRow();
dr["this"] = "1";
dr["is"] = "data1";
dr["a"] = "data1.1";
dr["test"] = "data1.2";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["this"] = "1";
dr["is"] = "data1";
dr["a"] = "data2.1";
dr["test"] = "data2.2";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["this"] = "1";
dr["is"] = "data1.3";
dr["a"] = "data3.1";
dr["test"] = "data3.2";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["this"] = "2";
dr["is"] = "data2";
dr["a"] = "data4.1";
dr["test"] = "data4.2";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["this"] = "2";
dr["is"] = "data2";
dr["a"] = "data5.1";
dr["test"] = "data5.2";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["this"] = "3";
dr["is"] = "data3";
dr["a"] = "data6.1";
dr["test"] = "data6.2";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["this"] = "4";
dr["is"] = "data4";
dr["a"] = "data7.1";
dr["test"] = "data7.2";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["this"] = "4";
dr["is"] = "data4";
dr["a"] = "data8.1";
dr["test"] = "data8.2";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["this"] = "4";
dr["is"] = "data4.4";
dr["a"] = "data9.1";
dr["test"] = "data9.2";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["this"] = "5";
dr["is"] = "data0.4";
dr["a"] = "data0.1";
dr["test"] = "data0.2";
dt.Rows.Add(dr);
int icom = dt.Rows.Count;
for(int i = 0;i<dt.rows.count;i++)
{
="" this.irow.add(0);
="" this.irowspan.add(1);=""
="" }
="" datagrid1.datasource="dt;
" datagrid1.databind();
="" #region="" web="" form="" designer="" generated="" code
="" override="" protected="" void="" oninit(eventargs="" e)
="" codegen:="" this="" call="" is="" required="" by="" the="" asp.net="" designer.
="" initializecomponent();
="" base.oninit(e);
="" }
="" <summary=""> /// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.DataGrid1.ItemCreated+=new DataGridItemEventHandler(DataGrid1_ItemCreated);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
protected ArrayList iRow = new ArrayList();
protected ArrayList iRowSpan = new ArrayList();
private void DataGrid1_ItemCreated(object sender, DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.AlternatingItem
|| e.Item.ItemType == ListItemType.Item)
{
if(e.Item.ItemIndex > 0)
{
for(int iCol = 0;iCol < dt.Columns.Count;iCol++)
{
if(dt.Rows[e.Item.ItemIndex][iCol]
== dt.Rows[e.Item.ItemIndex - 1][iCol])
{
iRowSpan[iCol] = Convert.ToInt32(iRowSpan[iCol])+1;
}
else
{
DataGridItem dgi = this.DataGrid1.Items[Convert.ToInt32(iRow[iCol])];
dgi.Cells[iCol].RowSpan = Convert.ToInt32(iRowSpan[iCol]);
for(int i = Convert.ToInt32(iRow[iCol]) + 1;i <= e.Item.ItemIndex - 1;i++)
{
this.DataGrid1.Items[i].Cells[iCol].Visible = false;
}
iRowSpan[iCol] = 1;
iRow[iCol] = e.Item.ItemIndex;
}
}
}
}
}
}
}
123456789
|
|
|
|
|
Simple - Convert
there's a build in convertion from ... to ...
check the menu bar when u start VS 2005
have fun
kobkob
|
|
|
|
|
Thanks very much...;)
123456789
|
|
|
|
|
Hello,
I am using config file in C# form application. I have provided UI which takes the data form user and on request saves the data to the Properties.Settings.Default.MyVal
The problem is that internally(while debugging the application i saw) it knows that the particular data has been modified and reads the modified data but these changes are not reflected in app.config file.
How should i save the data to the Properties.Settings.Default.MyVal file so that it reflects to the app.config file exacly.
Thanks.
|
|
|
|
|
gajesh wrote: The problem is that internally(while debugging the application i saw) it knows that the particular data has been modified and reads the modified data but these changes are not reflected in app.config file.
I had a couple of thoughts on this, though I'm not an expert:
When you are running in debug mode, I thought it wrote changes to a temporary config file in the Debug directory rather than in the project directory. You might check that.
Also, how are you writing out application-scoped settings? I know that user-scoped ones can be assigned, but I thought application ones were read-only. I know you can read the XML yourself and do it, but I *thought* only user settings were writable.
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?
|
|
|
|
|
HI,
I hope anyone can point me to an article or anoyher aource
where i can find out how to handle COM(Serial Bus) and to
R/W from Hardware Cards,
TNKS
kobkob
|
|
|
|
|
There's at least one article on this site, I used it to handle COM communicaton in .NET 1.1 ( where I needed an external dll, but I think 2.0 has it built in )
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
TNK and again TNK
kobkob
|
|
|
|
|
Use the SerialPort class.
Standards are great! Everybody should have one!
|
|
|
|
|
TNK and again TNK
kobkob
|
|
|
|