|
Sorry, I meant an internal[^] style, not an inline style.
/ravi
|
|
|
|
|
hi, I am trying to get the data from datatable in to DataTableReader so i can read the data like datareader.
I am getting error "DataTableReader is invalid for current DataTable" when trying to call the GetValues method on DataTableReader.
Please shed some light. If it helps here is my code in C# 2.0
public void Execute()
{
using (DataTableReader dataTableReader = new DataTableReader(myDataTable))
{
object[] values = new object[dataTableReader.FieldCount];
int fieldCount = dataTableReader.GetValues(values);
string id= values[4].ToString();
string Type = values[0].ToString();
}
}
i am poppulating a datatable from SQL 2000 database and is getting 4 rows back ( i can see that in datatable viewer in debug mode). I am also able to get the field count on datatableReader which is 6 (=number of columns).
However, when i get to the point where i need to get the values from the dataTableReader using
dataTableReader.GetValues(values), that's where it breaks up and states "DataTableReader is invalid for current DataTable"
Please shed some light
Thanks
Needy
|
|
|
|
|
Hey!
I'm new in c#, and i'm trying to make a template browser, that stores html strings in variables.
My problem is, how do i store the html to a string?
The html looks something like this:
<br />
<HTML><br />
<HEAD><br />
<title>test</title><br />
</HEAD><br />
<BODY><br />
<a href="http://www.codeproject.com/">link</a><br />
</BODY><br />
</HTML><br />
I have tryed this "string html = @"<The html>"; " but doesn't work
Any suggestions?
-- modified at 11:42 Thursday 22nd February, 2007
|
|
|
|
|
Scripter47 wrote: but doesn't work
Can you explain what you mean by "doesn't work"?
/ravi
|
|
|
|
|
When i have a code like this:
string html = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />
<title>Untitled Document</title>
</head>
<body>
</body>
</html>";
Then it wouldn't compile
How do I do it?
|
|
|
|
|
You cannot stretch a string literal across multiple lines like that. It should be:
string html = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" " + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html " + "xmlns=\"http://www.w3.org/1999/xhtml\"><head><meta http-equiv=\"Content-Type\" " + "content=\"text/html; charset=iso-8859-1\" /></head><body></body></html>";
"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." - Rick Cookwww.troschuetz.de
|
|
|
|
|
Scripter47 wrote: it wouldn't compile
Right - that's incorrect syntax. A string literal can't include an unescaped new line character. One way to do it is to use the string concatentation operator.
string html = "<!DOCTYPE html PUBLIC ...";
html += "..."; /ravi
|
|
|
|
|
Hi,
a valid string constant has matching double quotes on one (or every) line;
if multi-line, it needs + operators for concatenation (then strictly speaking it
is a string expression containing multiple string constants);
if new-lines are wanted, you must include them explicitly.
Example:
string str="part1\n"+
"part2\n"+
"part3.";
There is no backslash-at-end-of-line or auto-concatenate trick (as in C)
The compiler will concatenate for you, so the multi-line source code does not
result in additional run-time code.
|
|
|
|
|
Thanks All
I didn't think that i'd have to do that
Thanks again
|
|
|
|
|
How do I change the color of the forms frame in my application?
The color is now depending on the settings the users have done in Windows Display Properties, and I want to get control over colors in my application? I thought this would be simple, but I cannot find any ease way to do it...
Claes
Clarre
|
|
|
|
|
The non-client areas of your forms (board and titlebar) are determined by the system. The only way to change those colors is to ownerdraw the entire form. You'll have to handle all the non-client painting messages and do all the drawing of the non-client area yourself.
Is it really worth the work?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks Dave,
as I said "I thought this would be simple" but after trying some stuff (like changing the SysColors when the form is activated and restore when deactivated) I think I agree. Maybe it is not really worth the effort...
I will try one more approach and if it is not good I'll surrender.
Clarre
|
|
|
|
|
I want to know why this does not work. It is very simple, but when I click on it, it does not show the message box. I want to know why.
<br />
MainMenu mainMenu1 = new MainMenu();<br />
MenuItem menuItem1 = new MenuItem("&File");<br />
<br />
menuItem1.MenuItems.Add("Data");<br />
menuItem1.MenuItems.Add("Computer"); <br />
menuItem1.MenuItems.Add("Keyboard");<br />
menuItem1.MenuItems.Add("Telephone");<br />
<br />
menuItem1.Click += new EventHandler(OnComputer);<br />
<br />
void OnComputer(object sender, EventArgs e)<br />
{<br />
MessageBox.Show("You click on computer", "Computer Click");<br />
}<br />
|
|
|
|
|
That looks like you've assigned it to the File item, not the Computer item.
|
|
|
|
|
The computer item is a subitem of the file menu. So how can I assign it to the computer item. How can I fix that?
|
|
|
|
|
mfcuser wrote: how can I assign it to the computer item.
MainMenu mainMenu1 = new MainMenu();
MenuItem menuItem1 = new MenuItem("&File");
menuItem1.MenuItems.Add("Data");
<code>MenuItem computerMenuItem = new MenuItem("Computer");
menuItem1.MenuItems.Add(computerMenuItem);</code>
menuItem1.MenuItems.Add("Keyboard");
menuItem1.MenuItems.Add("Telephone");
<code>computerMenuItem</code>.Click += new EventHandler(OnComputer);
void OnComputer(object sender, EventArgs e)
{
MessageBox.Show("You click on computer", "Computer Click");
} /ravi
|
|
|
|
|
It is working fine now. About if I have several menu items. There must be a way to pack them to an array rather than doing it one by one. So the way I had "Data", "Keyboard", "Telephone" was incorrect. The menu items need to have their own variable to identify them rather than single string.
|
|
|
|
|
I m going to develop cd burning program
I m using acclImapiwrapper; it returns error at DiscMaster.RecordDisc(bool simulate, bool ejectwhencomplete) method and the error code is 0x80040220.
It may be due to a lot of events called during disc record but how can i control them
Can any help me this regard.
Raza Hussain
|
|
|
|
|
Raza Hussain wrote: acclImapiwrapper
What is acclImapiwrapper?
|
|
|
|
|
acclImapiwrapper; it is dll file.
Raza Hussain
|
|
|
|
|
Will this[^] article help? (Apologies if you've already seen it).
/ravi
|
|
|
|
|
Hi friends,
I have a simple problem. I tried my best but couldn't find a way to do. hope you people will know it. I defined a variable or param in xsl file by using following tags <xsl:variable> or <xsl:param> now I want to use value of this in .cs file of my project by using c#. Will any of you tell me solution of it? I will be really thankful to you people.
Greetings,
Abubakar
|
|
|
|
|
Please don't double post.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
If on the other hand you are unhappy with a posting, please modify it instead of posting a new one in a new thread. You can do this by clicking on the modify link in the bottom right corner of a posting.
Regarding your problem, I'm not sure whether I really get what you are trying. If you want to retrieve the specific value from the XSL file at runtime, you could use the XmlDocument or XmlTextReader as the file is (or at least should be) a valid XML file.
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
I'm not sure if this is possible, but I need to call a method in a running program from a different program. The method I want to call is being loaded into the remote EXE via a DLL. If I try using DllImport, it does call the method, but it doesn't work correctly. The method is supposed to return its class's member information, but if I use the DllImport from C# to call the method, it doesn't return the actual remote class's members, just some garbage values. Also, the program and DLL are already compiled, were written in C++, and don't include support for .NET remoting.
For example, TestApp has a class called TestClass. This class has a bool called TestMember and a method called TestMethod that returns the value of TestMember. When I write a program and use DllImport to import TestMethod, it returns true, even when I know that the remote member is actually false. It does this with all of the methods I try to import. I'm guessing it has something to do with the fact that TestMember and TestMethod belong to an instance of an object rather than being static.
I would appreciate if someone could point me in the right direction to figuring this out. Using C++ is ok too, but I'm more comfortable with C#.
|
|
|
|