|
i want to create multiple datagrid(each displays different data table ) in same window to display diferrent information in each datagrid.But datagrid should be created dynamically
during runtime depending on the number of data table i want to display
|
|
|
|
|
you can do it by
DataGrid dg1 = new DataGrid();
this.Controls.Add(dg1);
on Form1_load method,but u have to check the locations of datagrids added
so that they should not overlap each other
rahul
|
|
|
|
|
1st know no. of data table in dataset.
base on it make a for loop and create data grid.
Regards
Chintan
www.visharadsoft.com
(Nothing is so purify as KNOWLEDGE)
|
|
|
|
|
Good day.
I've been working with C# for the last few months and really like it a lot.
TheCodeProject has really helped me progress quickly and get up to scratch quickly
by offering top quality post that are direct and easy to follow.
I've been working on a new project and was wondering how you you would customize a
form? I would like to give my form round corners or make the border transparent etc.
I've been looking around all over the pace but can't find anything about the topic.
I know TheCodeProject.com has brilliant programmers writing here so I'm sure someone can
answer my question.
Thanks in advance
|
|
|
|
|
Ryan Blake wrote: TheCodeProject has really helped me progress quickly and get up to scratch quickly
by offering top quality post that are direct and easy to follow.
So why don't you search codeproject?
These links will help you:
irregularshapedform[^]
ShapeControldotNET[^]
|
|
|
|
|
Hi.
I have some enums generated from xsd files, which I'll use intensively in my program.
One task involves storing data into a database, including these enum values. The field type of the database which is use for this table is text.
How should I store, and more importantly retrieve the values of the enums?
How could I convert from string to a custom enum type?
Thanks.
|
|
|
|
|
Hello,
As enum is int Type it makes no sence to store it as a text I guess!
I would cast it to (int)MyEnum.
But you should use fixed values for your enum, which is important for consistance after updates!
All the best,
Martin
|
|
|
|
|
Ok, so for example if I have this enum(mind the syntax):
Dog - 1
Cat - 2
Flying Squirrel - 3
and I store in the database values 1,2 or 3, is it possible after I retrieve these values to convert 1 to Dog, 2 to Cat and 3 to Flying Squirrel?
Thanks.
|
|
|
|
|
Hello,
Just do the casting in the other direction.
int dbvalue = ?;
FancyAnimals dbFancyAnimals = (FancyAnimals)dbvalue;
All the best,
Martin
|
|
|
|
|
Sure, simply cast them to the enumeration and it will work!
enum Numbers
{
One = 1,
Two = 2,
Three = 3
}
class Program
{
static void Main(string[] args)
{
for (int i = 1; i <= 3; i++)
{
Numbers n = (Numbers) i;
Console.WriteLine(n.ToString());
}
}
}
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
Martin# wrote: As enum is int Type it makes no sence to store it as a text I guess!
I think he's talking about the names of the enumeration values. For instance:
enum Numbers
{
One = 1,
Two = 2,
Three = 3
} He wants to store "One", "Two", and "Three" in the database and somehow use them to get 1, 2, and 3. I used something like this at my previous company, but I don't remember now.
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
Right. I want to store "One", "Two", "Three" and retrieve whatever values are required to correctly fill the enum variables in my program.
Sorry for the confusion.
|
|
|
|
|
I think I understood it.
Look at my posts.
All the best,
Martin
|
|
|
|
|
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
Vikram A Punathambekar wrote:
I wanted to say, that I understood it, but recomended an other solution!
All the best,
Martin
|
|
|
|
|
Hello.
Here is what you were searching for.
Again I don't recomend it!
string actstring ="Dog";
FancyAnimal actAnimal = (FancyAnimal)Enum.Parse(typeof(FancyAnimal), actstring, true);
Be aware that it will throw an exception if it has no member of that fits!
All the best,
Martin
|
|
|
|
|
Thanks.
A man's gotta' do what a man's gotta' do. Even if it's not recommendable.
|
|
|
|
|
blackjack2150 wrote: A man's gotta' do what a man's gotta' do. Even if it's not recommendable.
But safety first, my friend.
You could validate the string, if you get all the members of the Enum and store it:
string[] members = Enum.GetNames(typof(FancyAnimal));
System.Collections.Specialized.StringCollection memberscollection = new System.Collections.Specialized.StringCollection();
memberscollection.AddRange(members);
Than just make the check:
string act ="dog";
if(memberscollection.Contains(act))
{
Hope it helps!
All the best,
Martin
|
|
|
|
|
Schweet.
Why do you not recommend it? Because of the exception it could throw, or because it's slow?
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
Vikram A Punathambekar wrote: Why do you not recommend it? Because of the exception it could throw, or because it's slow?
No, just imagen that.
Software 1:
public enum FancyAnimal
{
dog= 0,
cat= 1,
squirel= 2,
}
text "squirel" is stored in db.
Than in Software 2:
public enum FancyAnimal
{
dog= 0,
cat= 1,
squirrel= 2,
}
No good!
All the best,
Martin
|
|
|
|
|
I assume you're trying to highlight the misspelling of Squirrel?
If the apps are unrelated, it doesn't make sense to make them share the same DB table for storage. Personally, I would go for a readable representation like Dog rather than 0 in the database.
I like your suggestion for a different reason - the code is simpler. I guess I could store the 0 along with Dog in the database and use that mapping.
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
Hello,
Vikram A Punathambekar wrote: I assume you're trying to highlight the misspelling of Squirrel?
Exactelly!
Vikram A Punathambekar wrote: If the apps are unrelated, it doesn't make sense to make them share the same DB table for storage.
Sorry, for my bad example!
I off course ment:
YourProgramm Version 1:
and
YourProgramm Version 2:
Vikram A Punathambekar wrote: Personally, I would go for a readable representation like Dog rather than 0 in the database.
As a customer, I would be pretty pissed if I had to fill in my formulars again after a software update!
Only because there was a missspelling found in the code!
All the best,
Martin
|
|
|
|
|
Hi All,How can I create TreeView Control in WebForm.Im using ASP.Net1.1v.
Help me,please.Thank You in advance..
Hi,Im Razana
|
|
|
|
|
Hi Razana,
You can use the Internet Explorer Webcontrols of Microsoft for this. They add 3 more controls for you to use in ASP.Net 1.1 (I have blogged about the tabcontrol[^]).
You can download them Here[^].
Cu
Sven Cipido
|
|
|
|
|
can i save a graphich(ex rectangle) with DrawRectangle(bla...bla...) into some variabel ??
thx
Beginner C#
Yogyakarta - Indonesia
|
|
|
|