|
That's a lot of garbage to go through when all you need for a Login Form is wheather or not the user was successfully logged in or not. I like this in the main form better:
frmLoginForm myLoginForm = new frmLoginForm;
DialogResult loginResult = myLoginForm.ShowDialog();
if (loginResult == DiaglogResult.OK)
{
}
else
{
}
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i have a com object that returns me a xml string how do i use readxml in a dataset to convert the string to a table
thanks
chad
|
|
|
|
|
DataSet.ReadXml takes a Stream , TextReader (or derivative of each), or a path to a filename as a String . Since you already have the content in a String , a StringReader would be a logical choice:
DataSet ds = null;
using (StringReader reader = new StringReader(xmlString))
ds.ReadXml(reader);
return ds;
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hmm, I like your a little better than mine. Time for bed, I need
- Nick Parker My Blog | My Articles
|
|
|
|
|
cmarmr wrote:
how do i use readxml in a dataset to convert the string to a table
I assume you mean DataTable when you say table. Here is a simple example on how you could do such a thing:
string xml = "<numbers><number>1</number><number>2</number></numbers>";
XmlParserContext context = null;
XmlTextReader reader = new XmlTextReader(xml, XmlNodeType.Element, context);
DataSet ds = new DataSet();
DataTable t = null;
ds.ReadXml(reader);
t = ds.Tables[0];
foreach(DataRow row in t.Rows)
foreach(DataColumn col in t.Columns)
Console.WriteLine(row[col]);
- Nick Parker My Blog | My Articles
|
|
|
|
|
I want to disable one of the items (checkBox) of the
checkedlistBox.
how can i do that
AH_Eng
|
|
|
|
|
I don't know how to disable an Item in a checkbox, but you can remove the Item by it's handle on an event.
_____________________________________________________
Believe! Every thing has a purpose
|
|
|
|
|
Imho there is no direct way to do this, but you could make an owner-drawn checkedlistbox out of it (this.DrawMode = DrawMode.OwnerDrawFixed; ). Then you would have to override OnDrawItem and draw the item yourself.
This could look like the following
<br />
protected override void OnDrawItem(System.Windows.Forms.DrawItemEventArgs e)<br />
{<br />
e.DrawBackground();<br />
e.DrawFocusRectangle();<br />
Color textColor = e.ForeColor;<br />
if (ShouldBeDisabled(e.Index)) <br />
textColor = Color.Grey;<br />
<br />
e.Graphics.DrawString(Text, e.Font, new SolidBrush(e.ForeColor), <br />
e.Bounds.Left, e.Bounds.Top);<br />
}<br />
|
|
|
|
|
Hi, sorry if this has already been asked, but I've had a quick look and not seen anything similar. I don't have time to research at the moment and work never waits...
Basically, I make changed to rows in a dataset, and I want to update the access file that the data comes from. I've tried the DataSet.GetChanges, but when I call the OleDbDataAdapter.Update() is chucks a wobbly and says I need an update string. But I don't know the field names, nor do I want to. It already knows the difference, else the GetChanges would've failed, how to I get to update the changed rows without me having to construct an SQL update statement? I have tried to construct it, but it's a bit difficult when you don't know the field names, etc.
Thanks for any help.
Brian.
"Ergo huffabo et puffabo et tuam domum inflabo" ait magnus malus lupus.
|
|
|
|
|
OleDbDataAdapter da = new OleDbDataAdapter("selectstatement",cn);
OleDbCommandBuilder cb = new OleDbCommandBuilder(da);
you need to create a OleDbCommandBuilder and it will create and update string for you
chad
|
|
|
|
|
Hi, here's some code, it basically removes unwanted characters that may be in string fields in a table, then tries to save the changes to the table. I've tried a few different variations, but none seem to work. Either I get an exception or it seems to work, but the file is unchanged.
Thanks.
statusBar.Text = "Cleaning "+sDataFile+"...";
if(m_dataSet!=null)
{
m_connection.Open();
Int32 iCount = m_dataSet.Tables["table"].Rows.Count;
for(Int32 i=0;i<icount;i++)
{
="" application.doevents();
="" int32="" ilength="m_dataSet.Tables["table"].Rows[i].ItemArray.Length;
" for(int32="" iindex="0;iIndex<iLength;iIndex++)
" m_dataset.tables["table"].rows[i].beginedit();
="" if(m_dataset.tables["table"].rows[i].itemarray[iindex].gettype()="=typeof(String))
" string="" schanged="null;
" sitem="(String)m_dataSet.Tables["table"].Rows[i].ItemArray[iIndex];
" if(sitem!="null)
" somehow="">>;
if(sChanged.CompareTo(sItem)!=0)
{
iChanges++;
statusBar.Text = "Cleaning "+sDataFile+" - Number of Changes: "+iChanges.ToString();
m_dataSet.Tables["table"].Rows[i].ItemArray[iIndex]=sChanged;
}
}
}
m_dataSet.Tables[sTable].Rows[i].EndEdit();
}
}
if(m_dataSet.HasChanges(DataRowState.Modified)==true)
{
DataSet dataChanged = m_dataSet.GetChanges();
m_dataAdapter.Update(dataChanged,sTable);
m_dataSet.AcceptChanges();
}
m_connection.Close();
}
}
"Ergo huffabo et puffabo et tuam domum inflabo" ait magnus malus lupus.
|
|
|
|
|
There's many things wrong with this code. First of all - don't open and close the connection yourself (especially while editing the DataSet - it's a disconnected recordset to no connection is needed; this is not ADO); the OleDbDataAdapter opens and closes the connection reliably.
Second, OleDbDataAdapter.Update will call DataSet.AcceptChanges() internally - you do not need to call this yourself.
Third, as the other poster said, in order to update your database with the changed data in a DataSet , you need to have the corresponding properties of an OleDbDataAdapter - UpdateCommand , InsertCommand , and DeleteCommand - assigned appropriately. So, if you have records that have been changed, the UpdateCommand is needed. If the DataSet ultimately contains rows that were added or deleted, you need the InsertCommand and DeleteCommand properties assigned, respectively. For simple queries (whatever is assigned to the SelectCommand ) you can use the OleDbCommandBuilder as the other poster said. How do you expect the OleDbDataAdapter to update the database if it doesn't know how to update the database?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
how do i execute a .bat file and have the program halt until it finishes. what i'm doing is creating an external software installer so i can just check which programs i want to install and it installs it. once the user presses 'Install' i want it to create a temp .bat file and then execute the .bat file and wait for all the installs to finish before coming back to the main program. i would also like the .bat file to execute silently so you don't see the command prompt.
thanks,
Rob Tomson
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
|
Anders Molin wrote:
and in the startinfo you can set that it should show no window...
To note, this only works in Windows NT-based OSes (Windows NT 4.0, 2000, XP, and 2003 currently; Windows stopped with Me). A console window will appear for console apps regardless of ProcessStartInfo.CreateNoWindow . It's just the nature of Windows existing on top of DOS while Windows NT simply contains a command prompt (big difference).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am creating a Custom Form Designer for my application.
I need to create rectangles around controls to allow the user to resize them and show them as selected.
The problem is if the control is on top of another control, the rectangle is drawn behind all the controls and cannot be seen.
Does anyone know how I can draw a rectangle on top of everything ?
Thx!
- Shardool
|
|
|
|
|
I need to write custom versions of two of the three components involved in a streaming audio setup. Specifically, I need to write a custom streaming server implementation, and at least one custom source application.
Here are the kickers: The server needs to work with existing standard source applications (SAM2 Broadcaster[^], WinAmp, etc). Also, the source app(s) need to work with existing standard servers (Icecast[^], Shoutcast[^], etc.)
I need for these apps to support streaming MP3 or Ogg Vorbis (or both/either). The reason I'm not using any of the standard apps I've listed above is that none of them have the specific features I need for what I'm going to be doing. Although some of them are open-source (Icecast and some clients), they're all written in multi-platform C/C++, and the code is not well documented or easily readable for someone that's not a full-time C programmer.
So, does anyone know of any libraries (open-source, free, or affordably commercial) that will simplify the development process? Any tips, pointers, or web links on where I should even start trying to write my own?
Anything that will be helpful in this endeavor will be greatly appreciated. I know absolutely nothing (from a technical perspective) about the specifics of writing streaming audio code.
Thanks for whatever help you can give.
Grim (aka Toby) MCDBA, MCSD, MCP+SB
SELECT * FROM user WHERE clue IS NOT NULL
GO
(0 row(s) affected)
|
|
|
|
|
I have a question, and on MSDN I couldn't find an answer:
will there be an Visual C# Standard Edition or will it be replaced by VC# Express Edition?
If there will be a C# Standard Edition aside from Express Edition where will be the differences then?
|
|
|
|
|
The express edition doesn't replace any existing editions. MSDN subscribers can get their hands on the full version of Visual Studio 2005 beta right now in fact.
The express edition is meant for hobbyists, students, and other non-professionals. The differences between that and the standard edition.. go read the Express Edition FAQ, they're outline there (don't have a link, go search MSDN). Probably things like unit testing, app deployment, app security configuration settings and other more advanced features will be in the standard IDE.
#include "witty_sig.h"
|
|
|
|
|
Judah Himango wrote:
MSDN subscribers can get their hands on the full version of Visual Studio 2005 beta right now in fact.
Actually, no we can't - not yet anyway. Should be able to in a couple days. The latest post is still the May '04 CTP.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Anyone have some good example code for calling Java routines from C#?
- Bruce
BRCKCC
|
|
|
|
|
Unless you're able to convert the Java .class file to a .NET assembly, I believe this will require either a COM bridge or Mono's IKVM Java runtime. Mono lead dev Miguel de Icaza wrote a Java app on top of Mono that might get you pointed in the right direction: clickity[^].
Additionally, if you have the Java source code, you could try recompiling as J# code which gets compiled as a .NET assembly.
#include "witty_sig.h"
|
|
|
|
|
I've got an article on that at http://www.devx.com/interop/Article/19845[^]. It's a new edition of an article[^] I wrote for CodeProject alost two years ago, which was a rewrite of an article I wrote about a year before that. Sure, there are already bridge products that have been out for a couple years, but these articles will tell you how it's done (using JNI and, optionally, COM - though not required if you P/Invoke native functions from the JNI library you'd have to write).
The DevX article I linked first goes into greater depth about calling Java methods from the JNI DLL.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello,
Does anyone know of a good documentation generator for .NET code (C# or VB.NET)? Is there anything comparable to JavaDoc? I've tried using VS.NET's built in html documentation generator, but I have found it's documentation to be pretty useless, especially because it shows every member of a class, including private members. Is there anything close to the quality of JavaDoc?
Thanks, Andreas
|
|
|
|
|
Use NDoc[^], a project I'm proud to be a part of. It's used by many companies and can generate many types of documentation, with support for additional documentors. You can produce HTML Help 1.x and 2.x documentation that looks and pretty much acts exactly as the .NET Framework SDK documentation - consistency definitely helps.
Microsoft MVP, Visual C#
My Articles
|
|
|
|