|
cheesepirate wrote:
int * p = array + 8;
Sorry but that bad code in any language! what is 8? 2 or 4 ints? I mean any compiler could produce wrong code for that! Now if you did the following, life would be different, and at least someone else can understand the code.
int array [16];
int * p = &array[2];
And I can almost gaurentee you, that that will work now via MC++.
top secret xacc-ide 0.0.1
|
|
|
|
|
Greetings,
When I inherit from a user control I would like to rearange the controls of the base control on the new control. E.g. I have to list boxes side by side on the base control. I would like to change that to one list box above the other on the inherited control. The code for these controls are the same and I would like to get reuse out of this if possible.
Thank you,
Brett
|
|
|
|
|
Make the list boxes in the base control as public and do then rearranging.
|
|
|
|
|
True enough, how simple. Protected is probably a much safer bet though.
|
|
|
|
|
sssyed_in wrote:
Make the list boxes in the base control as public and do then rearranging.
I think protected would be more appropriate.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Hi,
I have an object "obj" that is a TypeA. I have a Type object that refers to TypeA. How can I cast obj to TypeA? TypeA is dynamically created from a loaded assembly, so I need to be able to do it dynamically.
Or altenatively is there another way to get at obj's fields defined by the TypeA interface ?
thanks,
Matt
|
|
|
|
|
You gonna have to explain better, perhaps a code segment.
Dynamic casting is an urban legend, and is never required! (yes it does feel like u need it sometimes, but its not necessary, really)
top secret xacc-ide 0.0.1
|
|
|
|
|
maybe typeof() helps.
it will give the type of the object.
you should have cases of what types could obj be, it can't be just anything.
unless you should go for Generics in C# V2.0
find about generics here:
http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=370
|
|
|
|
|
Not possible. Because of the Common Type System (CTS) - part of the .NET Framework - the type must be known at compile time or the necessary IL instructions cannot be emitted as part of the module that gets embedded into the primary assembly. The best alternative is to develop a base class from which all of your loaded types (common, especially in plug-in style applications) and cast to that base class, relying on polymorphism to define your distinct types' functionality (that derive from that base class, of course).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi
I have implemented a download facility in my web site..I need to update my database after downlaod has been completed...the problem that i am facing is, i cannot trap when the download has completed..and hence cannot updated my Database because ideally the Database should only be updated when the download has been completed.
Please Help
Ashu
|
|
|
|
|
Try the ASP.Net forum
Kev Pearman MCP
|
|
|
|
|
Thnx mate..
I have posted this problem on ASP.NET but still i would be very gr8ful to if you people could guide me a little in this regard..
Cheers
Ashu
|
|
|
|
|
How to get the "CPU Serial Number", "CPU Model Type", "Amount of RAM", "Video Controller ID" and "SCSI ID" using c#
P.Chandramohan
|
|
|
|
|
P.Chandramohan wrote:
CPU Serial Number
Thats only an optional P3 feature, thats off by default.
Most other info you can probably get thru System.Management and WMI. You have to refer to the MSDN WMI docs for more info (note: they are well hidden!).
top secret xacc-ide 0.0.1
|
|
|
|
|
|
A useful article[^] from MSDN magazine about usage of WMI, which was already mentioned as solution for your problem.
www.troschuetz.de
|
|
|
|
|
Ok here is the question, Im useing Mysqldrivercs and ive got a dataSet with a table thats populated already, the same way on my Mysql server.. but I cant seem to get the data from the mysql server to load into my datagrid's dataset.. anyone have this problem? or have a sample code for it?
Thanks
|
|
|
|
|
Post some code, show us how you are updating the database and hopefully someone can point you in the right direction. Personally i would use a SqlDataAdapter to update the database from the dataset.
DataSet ds = new DataSet();<br />
System.Data.SqlClient.SqlDataAdapter sql = new System.Data.SqlClient.SqlDataAdapter();<br />
sql.Update(ds);
If thats not what you're trying to do then post a bit more info.
Cheers
Kev Pearman MCP
|
|
|
|
|
MySQLDataAdapter da = new MySQLDataAdapter();
MySQLConnection con = new MySQLConnection();
con = new MySQLConnection(new MySQLConnectionString(ip,
dbname,
username,
password).AsString);
con.Open();
MySQLCommand sql = new MySQLCommand("SELECT * FROM `character`",con);
MySQLDataReader reader = sql.ExecuteReaderEx();
if(reader.Read())
{
conn.Text = "Yes";
while(reader.Read())
{
}
}
reader.Close();
sql.Dispose();
con.Close();
}
where its while(reader.Read())
{
}
Ive put da.Fill(ds);
but thats not what I need.
|
|
|
|
|
To write back to the database use da.Update(ds);
da.Fill fills a dataset, if i understand what you are asking for you want to update the database from the dataset, this is where the .Update command comes in.
Kev Pearman MCP
|
|
|
|
|
thanks yeah I do want to have an update but thats a differnt story
Right now im trying to get it to load the data from my sql server to my client's dataset table.
|
|
|
|
|
OK, sorry i guess i got the wrong end of the stick there
You said in your previous post that da.Fill(DataSet) doesn't work.
This is how i would fill a DataSet from a DataAdapter, why is the Fill method not OK for yourself?
Kev Pearman MCP
|
|
|
|
|
Now I get an error:
System.InvalidOperationException: The SelectCommand property has not been initialized before calling 'Fill'.
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
|
|
|
|
|
You have to write the Select command for the data adapter so it knows what fields to pull out of the database. If you are using Visual Studio then just drag and drop a DataAdapter onto you form and it wil open a wizard. Follow the prompts and the select command will be created for you along with Update, Delete and Insert statements, as long as you specify the primary key for your data.
If you are not using visual studio then you will have to create the SQL statements for selecting and updating the data required and assign them to the relevant properties of your DataAdapter
Kev Pearman MCP
|
|
|
|
|
Im useing VS .NET 7.1, I didnt get a wizard when I did that, but it did put the adapter there.. is there a howto on setting up these commands properly?
Thanks
|
|
|
|