|
I have a DataGrid in my windows app. One of the fields is a date time type. It's showing up at a date in my DataGrid. I really need to see the time too. How can I change the format of this one field in the DataGrid?
|
|
|
|
|
To change the format of a column, you need to set the Format property of the DataGridTextBoxColumn corresponding to the column. See the example code under DataGridTextBoxColumn should help.
Burt Harris
|
|
|
|
|
Thanks you for your reply.
In my application I'm trying to display records in a table that let me know that some services I have written are working. At this point I'm updating the display on a button click. I tried to apply the code I found in the example you pointed me to. You can see the error message from my exception trap. Can you tell me where I when wrong?
private void m_btnUpdate_Click(object sender, System.EventArgs e)
{
this.sqlDataAdapter1.Fill(this.imAliveDataSet1,0,0,"ImAlive");
// Gets the DataGridTextBoxColumn from the DataGrid control.
DataGridTextBoxColumn myTextBoxColumn;
myTextBoxColumn = null;
// Assumes the Time column is a DataGridTextBoxColumn.
try
{
myTextBoxColumn = (DataGridTextBoxColumn)dataGrid1.
TableStyles["ImAlive"].GridColumnStyles["Time"];
}
catch (Exception excpt)
{
string strMsg = string.Format("{0} Exception caught.", excpt);
}
// Gets the DataGridTextBox for the column.
DataGridTextBox myGridTextBox;
myGridTextBox = (DataGridTextBox) myTextBoxColumn.TextBox;
strMsg "System.NullReferenceException: Object reference not set to an instance of an object.
at FordMon.Form1.m_btnUpdate_Click(Object sender, EventArgs e) in c:\source\ford\fordmon\fordmon\form1.cs:line 227 Exception caught." string
|
|
|
|
|
Is there an method or a way of preforming a SQL SELECT statement on a DataTable so that it returns a array of Rows?
The DataTable.Select() method won't do the job as my query is a bit too complex for me to use it.
This is my SQL query:
SELECT COUNTY_ID , NAME
FROM TOWNS
WHERE NAME IN
( SELECT NAME FROM TOWNS
GROUP BY NAME HAVING COUNT(*) > 1);
Do I need to use a SQLDataAdapter or something? Just a guideline on how I should go about doing this would be helpful.
Thanks
|
|
|
|
|
While a data set has some of the features of a relational database, it's not got a full SQL interpreter, so DataTable.Select won't do what you're looking for. If your data is in SQL database, you can issue the query with a SQLDataAdapter as you suggest.
Hope that helps.
Burt Harris
|
|
|
|
|
Hi,
I was wondering if it is possible to program a low level network application in .net. I mean I want to choose the network interface that handles the packets sent from my app, I want to get every IP packet that passes thru my computer, and so on...
Can anyone give me any pointers?
Thanks a lot,
Andrei Matei
andreimatei@home.ro
|
|
|
|
|
How can I to determine when socket connected to my TcpClient is close connection?
I do this...
IPAddress ipAddress = Dns.Resolve(Dns.GetHostName()).AddressList[0];<br />
TCPListiner = new TcpListener(ipAddress,PortNumber); <br />
TCPListiner.Start();<br />
<br />
while(true)<br />
{<br />
if (TCPListiner.Pending()) <br />
{<br />
TcpClient TCPClient = TCPListiner.AcceptTcpClient();<br />
NetworkStream LNS = TCPClient.GetStream();<br />
}<br />
}
then I send some text throw NetworkStream LNS. Client can close connection. And result this....
System.IO.IOException: Unable to write data to the transport connection. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, So
cketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32
size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32
size)
|
|
|
|
|
Hi All!!
i want to to create crystal report at run time and set all its properties like texts,sections etc. but i am not getting the way to get in. it has many classes like
ReportObject
ReportClass
ReportDefinition
ReportDocumnet
but this is confusting that how to take start...
i want to do like this (this is just assumption)
CrystalReport report = new CrystalReport();<br />
Section section = new Section();<br />
report.Secctions.Add(section);
can anyone help??
sorry for my bad English.
|
|
|
|
|
Hi, I have a problem with drag and drop: every sample about it i have found shows only how to drag a text from a textbox to another or a listview/treeview item to another. Instead, I have some controls (some shapes) and i need to allow to the user to drag them over the form like the visual studio IDE, with the resizing handles, the drawing of the dragged control's border, etc... exactly how the IDE! Can anyone help me, showing some samples (in vb.net or c#)?
|
|
|
|
|
May be a good starting point[^].
|
|
|
|
|
Ok, so I have this app that you fill in your subject and then the message and then it formats it in the particular way i told it to, onto my webserver as a .xml file....
XmlTextWriter writer = new XmlTextWriter("poofacedjohn.xml", null);
But, what I need is for the name of the xml file not to be poofacedjohn.xml, but rather the year, month, day, hour, and minute of the local machine...
like.....
20030426_1718.xml
2003 04 26 17 18
|year||month||day|_|hour||minute|
how would I acheive this...? I can do it in asp.net, but it's not working for me as just a regular windows app.
/\ |_ E X E GG
|
|
|
|
|
String szfilename = System.DateTime.Now.ToString("yyyyMMdd_HHmm") + ".xml";
|
|
|
|
|
My C# app has a RichTextBox which is using a right-click context menu. How can I add icons next to the text in the menu?
I found a few places that said they had add-ins to do this, but I'd rather just understand how it works to do it myself.
Can anybody explain it, or point to a resource which explains it?
Thanks.
There are only 10 types of people in this world....those that understand binary, and those that do not.
|
|
|
|
|
Windows Forms (at least in .NET 1.0) does not allow that. You'll need to use a library such as Lutz Roeder's CommandBar for .NET[^].
Cheers,
Arun
|
|
|
|
|
How can I access MySQL from C# without using stuff that I have to configure outside of my program? (The tutorials I see require me to configure ODBC for example)
I want to be able to just enter the address in my program and connect to it, but I see no easy functions like mysql_connect() or so...
|
|
|
|
|
SourceForge.net has a project that is developing a managed MySql provider.
|
|
|
|
|
I've looked everywhere to try and find out how to print decent images.
I've used a few programs which seem to be programmed in Delphi, and have asked the programmers if they do anything special when loading or printing and the answer is NO.
So why can't I get the same quality printing when using C#, the images are the right size from the start, so I just shove them into the printpage and fire them out to the printer.
The program is for printing CD covers, and the text etc is just not sharp.
Can anyone Please help, I'm a newbie and at a total loss at where to loko next.
|
|
|
|
|
I've been wondering whether VS.NET 2002 projects will work in VS.NET 2003. Will it need to go through some kind of a conversion process or something like that?
|
|
|
|
|
I think it's best to just open your 2002 projects in 2003 and recompile them... I found that Microsoft didn't change much of their methods' parameters or functions, just added some new stuff to the .NET framework...
|
|
|
|
|
The .csproj file format is upgraded, and VC#.NET 2K3 will automatically prompt when you open a C# 2K2 project.
|
|
|
|
|
VB.NET and C# projects will go fine. The only trouble will be with C++ projects, because there were some language changes, but not a big deal.
My latest article: GBVB - Converting VB.NET code to C#
|
|
|
|
|
We know the default TCP/IP port of SQL Server 2000 is 1433.
I can connect to DB from remote using SQLConnection class. But when the default port is changed, I couldn't.
How can I connect to DB with different TCP/IP port?
|
|
|
|
|
Hi mkomasi,
I have'nt tried much on SQL Server. Although, you may like to try http://www.connectionstrings.com/[^] for a variant of ConnectionString that can faciliate connecting to a different port. Alternatively, does OLEDB allow that? A suitable connectionstring should help you there too? Try that URL.
Deepak Kumar Vasudevan
http://deepak.portland.co.uk/
|
|
|
|
|
The content of the textbox is a pathname.
I want to change the path and then press
"save as default" -> now the default path
should be the new one (even after restarting)
Is this possible?
thanks and regards
markus
|
|
|
|
|
Yes, search on "Dynamic Properties", you can bound the Text property of your TextBox to a config file.
Hope this helps.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|