|
I think you need to explain what you want to do. What it looks like to me is that you want a dynamic reference for objects in your code, which is very odd...
|
|
|
|
|
Is it possible you want to name the dataset?
MyDataSet.Name = string variable.
You may even be able to do = new dataset(stringvariable)
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
This is a great windows based NMS tool. Enterprise grade network management software with a very easy to use interface that has tons of features.
Comes with a 30 day trial but you can download it here without registering it ahead of time.
http://www.dopplervue.com/software/setup.exe
Diassemble it for complete code samples of how to do this stuff.
http://www.red-gate.com/products/reflector/
Create plug-ins by adding pollers. One simple entry in a database table and a dll written in .NET.
|
|
|
|
|
You should pay the site if you want to advertise stuff.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
I'm making a small game, but because I'm new to VS C# .NET, so I need help please look at this form:
http://picasaweb.google.com/lh/photo/49JsG9IIMP9ByRsjSrxZFg?feat=directlink
There's a table with rows, and columns. Two ( 2) button: Add Row and Add Column. How to do( how to code?): - when user click Add Row button, my program add one( 1) row, with the same height with other rows. - when user click Add Column button, add one column, with the same width. - In my program has an Array: a[r][c], r: number of row, c: number of column. Of course that r and c can not be greater than 500( or somethings like that, because I do not intend to show more than 200s rows or columns). When click on Cell at position row 10, column 4, that Cell will change color to black. And If user press a number-key, a[9][3]= that number. For example, in that pic I showed, it's 9. Should I use TableLayoutPanel, or other Control? Thanks!
|
|
|
|
|
It all depends what you want to do.
Easiest (IMHO) would be to use a datagridview.
Plonk one on teh form, and put this code in the onclick events of your two buttons...
private void button2_Click(object sender, EventArgs e)
{
dataGridView1.Rows.Add(1);
}
private void button1_Click(object sender, EventArgs e)
{
dataGridView1.Columns.Add("name", "headername");
}
and yo'll have the basics.
Note you (probably) don't need to have an array as teh grid itself is effectively an array - so just store whatever you need in there.
In the KeyPress event of your grid you can thn have
private void dataGridView1_KeyPress(object sender, KeyPressEventArgs e)
{
dataGridView1.CurrentCell.Value = e.KeyChar;
}
You'll need to filter the keypresses to handle only what you want - but that should get you started...
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
Thanks you. But you forget 2 things
- How to set width of columns? I want to set all of them to 30.
- Copy data from datagrid to an array[,] ?
and I want to mark cells which are selected with other color( for example, "black")?
I'm learning about datagrid.columns ...
|
|
|
|
|
Sorry, I know how to set color for a cell. Just use code:
datagridview1.Columns[1].DefaultCellStyle.BackColor= Color.Black;
And set width for a column:
datagridview1.Columns[1].Width= 30;
but I still do not know how to copy data from datagrid to an array[,]
( the first row, first column will be copy to a[0,0]; 2nd row, 4th column will copy to a[1,3];..etc)
thanks
|
|
|
|
|
as i said - i'm not sure you need to - but if you want to
something like
for(int i = 0; i < width; i++)
{
for (int j = 0; j < height; j++)
{
array[i,j] == dataGridView1[i,j].Value;
}
}
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
I created a project using .NET Framework 3.0 before I downloaded 3.5...
using C# on Visual Studio 08
Creating a windows program, a basic forms program
I have the following:
using System;<br />
using System.Collections;<br />
<br />
<br />
namespace Zombie_Zombie_Zombie<br />
{<br />
partial class Form1<br />
{<br />
protected override void Dispose(bool disposing)<br />
{<br />
if (disposing && (components != null))<br />
{<br />
components.Dispose();<br />
}<br />
base.Dispose(disposing);<br />
}<br />
<br />
#region Windows Form Designer generated code<br />
<br />
private void InitializeComponent()<br />
{<br />
this.tabControl1 = new System.Windows.Forms.TabControl();<br />
...<br />
private System.Windows.Forms.RichTextBox outputRichText;<br />
private System.Windows.Forms.LinkLabel linkLabel14;<br />
<br />
class character<br />
{<br />
protected Hashtable charSheet = new Hashtable();<br />
protected Hashtable calcSheet = new Hashtable();<br />
protected Hashtable mutantStats = new Hashtable();<br />
protected Hashtable mutantPowers = new Hashtable();<br />
charSheet.Add("Name","")<br />
...<br />
charSheet.Add("Money", "");<br />
}<br />
<br />
}<br />
}<br />
<br />
Now I'm using this because that's the syntax given here: <a href="http://msdn.microsoft.com/en-us/library/system.collections.hashtable.aspx">MSDN Hashtable Class (System.Collections)
I had originally tried charSheet["Name"] = ""; because I was using Beginning C# Game Programming page 105 on Hashtables.
This is the error code I get:
<br />
Error 1 Invalid token '(' in class, struct, or interface member declaration C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\Zombie Zombie Zombie\Zombie Zombie Zombie\Form1.Designer.cs 499 26 Zombie Zombie Zombie<br />
...<br />
Error 39 Invalid token '(' in class, struct, or interface member declaration C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\Zombie Zombie Zombie\Zombie Zombie Zombie\Form1.Designer.cs 537 26 Zombie Zombie Zombie<br />
help please
|
|
|
|
|
From your code example, it is absolutely unclear which lines are in the class declaration and which are in the method flow (in InitializeComponent() ). If you try to declare a class (character ) from within a method or call a method (Hastable.Add ) from within a class declaration, the compiler won't buy it.
You can't do stuff like
void SomeFunction()
{
class SomeClass
{
}
}
or
class SomeClass
{
ht = new HashTable();
ht.Add(...);
}
My kind advice is that you should learn some basic softball programming first, then move on to OOP and C# and then move on to game development.
H.
|
|
|
|
|
lol. I learned oop over ten years ago on C++ before the ansi iso standard and just now trying to get back into it...
thanks for the help tho.
|
|
|
|
|
No offense meant I just couldn't decide if you screwed up copying the code example or if you screwed up writing the code. The latter would explain the compiler errors
Good luck, H.
|
|
|
|
|
i had forgotten that I was trying to build it using a template of sample code I was working with...
so I started again...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
public class character
{
protected Hashtable charSheet = new Hashtable();
protected Hashtable calcSheet = new Hashtable();
protected Hashtable mutantStats = new Hashtable();
protected Hashtable mutantPowers = new Hashtable();
public character()
{
}
charSheet.Add("Name","")
...
charSheet.Add("Money", "");
}
}
I still do not see what I'm doing. why won't it let me make a hashtable in the class character when it's apart of the namespace with System.Container ?
|
|
|
|
|
msheekhah wrote: charSheet.Add("Name","")
...
charSheet.Add("Money", "");
These two lines must be in a method, if you wish to avoid compiler errors.
Assignments and the like cannot just be in class scope, they must be in a method. Only declarations can be just in the class scope.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi,
My Project has references of Activeds and ADODB but as soon as i am building the setup it is asking for the Activeds and ADODB to be excluded. After these dlls are excluded the setup project is making a setup of the program. Now that i have excluded these dlls, the application is not running on another computer after the setup installation is complete.
Thanks
Shweta
|
|
|
|
|
Why are you excluding required DLLs. If you were delivering a car would you remove the battery and expect it to work? Have a 1 for a really stupid question.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Folks,
This is sorta tough to describe so please bear with me.
I have an Excel file that shells out to an exe on the lan. It works for me but for some others, as soon as the app tries to instanciate a custom class, I get a cryptic SECURITY ERROR - no inner exception. And when I say cryptic , it doesn't even seem that the constructor is called (tried throwing exceptions as soon as I entered NEW but didn't seem to register).
I know about using the ConfigWizards.exe to adjust inTRAnet security but no avail.
Any ideas?
|
|
|
|
|
Hi
i've wrote a sample database app, which use a single dataSet object in all over of the application (It's static). when a form open, the appropriate table of that dataset fill out and when form closing, that table clear.
my question is that Is this best practise (where performance & overhead is important) ?
u can download it via this link (http://rapidshare.com/files/227688281/Sample_Singleton_Pattern.rar.html[^]). plz run and test it and tell me your comments.
Notes :
1. Plz first execute DbScript.sql to create 'Test' database and stored procedures
2. Use vs 2008 to work with sample project.
3. Change connection string in app.config.
i'm waiting for your comments.
Thanks
|
|
|
|
|
I'm not saying that your job is bad. but...
I know better ways to do that, LinQ for example is an excelente way to work with data...
Preparing for 70-536
|
|
|
|
|
Yeah, probably not the worst way, but not the best either.
I very rarely use a DataSet at all; I think they were only created to make demonstrating VS and book writing easy.
They're like VB; they make doing easy things appear even easier, but quality results require more robust/lower-level techniques.
|
|
|
|
|
I actually needed a dataset recently, the proc was returning 2+ tables and was surprised my DAL had a method to support it. Datatables are the basic container in my DAL.
I found performance dropped off dramatically when returning multiple tables from a single proc.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
If performance and overhead is important, then don't use datasets (IMHO).
Use a datareader to get the data and populate objects (and collections thereof) and return them.
Do whatever is required to the objects, and have methods to re-populate the DB from teh new values.
Depending on your requirements you may need to have your objects implement interfaces or inherit from base classes that 'know' if they are new (to the DB) or have been changed - but that's fairly simple in most cases (again, without knowing the requirements it's difficult to judge)
The important thing, I think, is that if performance and overhead are important, writing it yourself will always be more efficient (OK, assuming you write it well) than a 'generic' solution.
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
Hi,
I 'm using c#.net(3.0),I want to extract audio from an AVI file(Audio/Video file *.avi) in wav format(*.wav) could anyone please tell how to do this using C#.net.
I'm using the AviFile.dll provided with source code at this link http://www.codeproject.com/KB/audio-video/avifilewrapper.aspx but the given example is not working with all *.avi.It is only working with the given test data.
thank you
|
|
|
|
|
I know nothing about how to do this in C# but one way or another, you will have to use some external library or program. In that case I suggest you dig some information on typical video-processing command line programs (mencoder, ffmpeg, others) and if you run then with the right switches, the'll do exactly what you need. I'm sure mencoder can extract audio, I just don't know the exact switches - google this.
If you want this in C# from scratch, you are looking at a LOT of work.
H.
|
|
|
|