|
Hi,
yep thts wht i am asking/looking for, can't we draw visuals on screen using C# alone without OpenGL?
Suman.
|
|
|
|
|
C# doesn't have any drawing functions. If your talking about drawing without using a non-Microsoft API, then your talking about GDI+. In C#, or any other language targeting the .NET Framework, the basic functionality is encapsulated by the System.Drawing namespace.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
Why does this code raise an exception?
<br />
OleDbConnection m_adoConn;<br />
OleDbCommand cmdPrj = new OleDbCommand("SELECT * FROM project", m_adoConn);<br />
OleDbDataReader readerPrj = cmdPrj.ExecuteReader();<br />
while(readerPrj.Read())<br />
{<br />
OleDbCommand cmdUp = new OleDbCommand("UPDATE project SET PrjName=\"TESTE\"", m_adoConn);<br />
}<br />
readerPrj.Close();<br />
The exception message is: "There is already an open DataReader associated with this Connection which must be closed first"
My main question is "WHY?" - is there anyway to keep the datareader opened, so i can change or insert some data to the current database (where the connection is pointing to)?
Thank u very much,
Dirso
|
|
|
|
|
The exception is quite clear: you can only have one DataReader open per connection. And how would keeping the DataReader open help you update the records? This isn't ADO - it's ADO.NET and it does work a little differently. The OleDbCommand.ExecuteNonQuery is how you update data, or you could use a DataSet and a DataAdapter derivative (in your case, using an OleDbDataAdapter ) to fill and update data. A DataSet is a disconnected recordset that contains tables with column definitions, change tracking, serialization support (in .NET 1.x, only to XML; in .NET 2.0, to XML and binary), and even referential integrity.
Read in the .NET Framework SDK about the DataSet class and the DataAdapter class, both of which include examples in the class and their members' documentation topics.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
A DataReader needs exclusive access to its connection and will not be able to share it with anything else while its open. If u need to execute some other query while a reader is active you will have to create a new connection.
|
|
|
|
|
Hello,
I have a datagrid with books, when the book is overdue i want it to change the text to Red. A for has been used to go through each row (works fine). But when it comes to a book that is overdue, l want it to change the text to red. I have tired using the code below, but does not work.
if ( dateDue < todaysDate )<br />
{<br />
grdBookOnLoan.Select(i);
grdBookOnLoan.ForeColor = Color.Red;<br />
grdBookOnLoan.UnSelect(i);<br />
}
Thanks in advance,
Steve
|
|
|
|
|
You might try adding an extra hidden column into the datagrid, a boolean that indicates whether the book is overdue. Then use the "OnPreRender" in your html markup to execute a method that checks if the book is overdue and changes the forecolor of the object if it is.
code works something like this
<br />
<asp:Label id="myLabel" runat="server" OnPreRender="CheckOverdue"/ ><br />
<br />
In your codebehind
<br />
public void CheckOverdue(object sender, EventArgs e)<br />
{<br />
System.Web.UI.Controls.Label lbl, lblIsOverdue;<br />
lbl = (System.Web.UI.Controls.Label)sender;<br />
lblIsOverdue = (System.Web.UI.Controls.Label)e.Item.Items.FindControl("lblIsOverdue");<br />
<br />
if(lblIsOverdue.Text == "true")<br />
{<br />
lbl.ForeColor = Color.Red;<br />
}<br />
}<br />
And that should do it. Please note that this code works on a label by label basis, not a row by row. I'm not sure what this type of method does to scalability or load times (never used it in an enterprise app). So if this is for a large app, you might want to load test with and without.
Hope that helps.
Tojamismis
A mind never grows without mistakes and questions.
|
|
|
|
|
hi all ,
I store a data in sql with sqlmoney type but when i try to divid sqlmoney value it give me error that it cant apply this operans with sqlmoney
SqlMoney salary;
salary/2;
please help
hay
|
|
|
|
|
The second operand has to be a SqlMoney structure too. Take a look at the documentation for more information regarding division of SqlMoney.
www.troschuetz.de
|
|
|
|
|
Ok, i'm trying the DirectX.Capture Class Library and it itsn't working.
i have a problem here because hr=1 after this
hr = enumDev.CreateClassEnumerator( ref category, out enumMon, 0 );
so it doesn't enter this "if"
if( hr != 0 )
throw new NotSupportedException( "No devices of the category" );
can anybody tell me what this means
Thanks,
|
|
|
|
|
Hi.
I want to know if there is any material availbale in the internet regarding soap extensions. I have a project where i have to construct the soap message by myself. so it would be very useful for me, if somebody can guide me to that.
Thanks
|
|
|
|
|
All,
I'm new to C#, coming from a C++ background. Is it possible to have a single namespace span multiple files and if so how?
Thanks,
Bill Weiss
|
|
|
|
|
Yes, it is.
File 1 (MyClass1.cs):
namespace MyNamespace
{
class MyClass1
{
}
}
File 2 (MyClass2.cs):
namespace MyNamespace
{
class MyClass2
{
}
}
www.troschuetz.de
|
|
|
|
|
Hi, guys and girls
How can I change the font of text displayed in a MessageBox?
Thanks
vigorous
|
|
|
|
|
AFAIK you cannot.
But it should be pretty simple to write your own MessageBox, which provides this feature.
www.troschuetz.de
|
|
|
|
|
Like Stephen said, you can't change the font in a message box put by the function call. You'll have to write your own MessageBox class, just a Form really, and format it the way you like.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hello,am a new user to .NET. when i use a datetimepicker ( format set to short), along with some more controls in a form, the first time i executed the project, Iam able to get the focus in the Datetimepicker control(by pressing tab).
But if u select a new value in the control and use tab again am not getting the focus in datetime control. IS THIS A PATCH IN DATETIME CONTROL?
But when u click on it , the mousedown event makes the selection. so, iam thinking of invoking the mousedown evnet in the Enter Event(when the control is active by pressing tab). But not sure how to do it. or is there any other way of achiveing this?
Please help me at the earliest. Much Thanks.
Regards,Manivannan.P
|
|
|
|
|
Does anyone know of a custom listbox that supports multiline and multicolumn with headers? An example of what I'm thinking of
1 Error request Priority: High
user complaining of
2 Error request2 Priority: High
bad data and other
Column1: Numbers
column2: Error request header with multiple lines underneath different font.
Column3: Additional info
So on and so on. I saw something like this. I have searched everyday for a custom listbox or maybe even a treeview with multiline listview like this. I am out of ideas on what other words I could google for. If anyone has encountred any custom control like this, please reply.
|
|
|
|
|
Try the ListView control, setting the View property to Details. Then just use the Columns collection property to create all the fields u need.
|
|
|
|
|
|
hi forum,
I want to integrate an old C application with a C# library (dll). I know there are various alternatives but i have choosen the "managed C++ extensions" way.
What i do is to modify the compiler options by adding the /clr option and to recompile the old C application... but the compilation returns this error:
Command line error D2016 : '/YXstdafx.h' and '/clr' command-line options are incompatible
do u know what is the problem and its solution?
I am using Visual Studio .NET 2002 (.NET Framework 1.0)
Thanks in advance!
Sergio.
|
|
|
|
|
hi,
I have solved the problem by setting the "Not Using Precompiled Headers" option, but now i have got another problem: I dont know how to use the imported C# dll.
What i do is to copy the c# dll in the "debug" folder. Then, I set the path of the "debug" folder in the "resolve #using reference" project property and finally, I import in the C++ program the C# dll by using the #using directive:
#usign "MyDLL.dll"
But now, how can I create an object contained in the DLL?
Thanks a lot!!
Sergio.
|
|
|
|
|
Your question belongs in the C++ Forum, not C#. If your trying to use the C# .DLL in Mnaged C++, it's a question for the Managed C++ Forum.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi, guys, I want to export my data into some standard file format, eg. excel and word. How can I do that?
Thanks a lot
vigorous
|
|
|
|
|
If anyone could help I posted this last week. I am having a problem and getting the following error on this piece of code:
A namespace does not directly contain members such as fields or methods.
I placed the web generated code inside the brace and it got rid of that error but i now got another one
Class FriendsReunion Default already defines a member called InitialiseComponent() with the same parmater types.
I do have other pages with .cs code holding initialisecomponent() however the other pages work fine. I did try adding numbers to it (initialisecomponent2()) but it still gave me the error above, with the respective number ofcourse.
I have added the code below and would be grateful if anyone could point me in the right direction.
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
//I removed using System.Drawing from here
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace FriendsReunion
{
public class _Default : System.Web.UI.Page
{
protected FriendsReunion.SubHeader ccSubHeader;
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
private void Page_Load(object sender, System.EventArgs e)
{
Table tb = new Table();
TableRow row;
TableCell cell;
Image img;
Hyperlink lnk;
if (Context.User.Identity.IsAuthenticated)
{
//Create a new blank table row
row = new TableRow();
//Set up the News image
img = new Image();
img.ImageUrl = "Images/globe.gif";
img.ImageAlign = ImageAlign.Middle;
img.Width = new Unit(24, UnitType.Pixel);
img.Height = new Unit(24,UnitType.Pixel);
//Create a cell and add the image
cell = new TableCell();
cell.Controls.Add(img);
//Add the new cell to the row
row.Cells.Add(cell);
//Set up the News link
lnk = new HyperLink();
lnk.Text = "News";
lnk.NavigateUrl = "News.aspx";
//Create the cell and the add link
cell = new TableCell();
cell.Controls.Add(lnk);
//Add the new cell to the row
row.Cells.Add(cell);
//Add the row to the table
tb.Rows.Add(row);
}
else
{
//code for authenticated users here...
}
//Finally, add the table to the placeholder
phNav.Controls.Add(tb);
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
InitializeComponent();
base.OnInit(e);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.Load += new System.EventHandler (this.Page_Load);
}
#endregion
}
}
|
|
|
|