|
THANKS A LOT!! however, can you please take a look my code and tell me what is wrong or even if this possible as I am new to C# ,but got job as C# programmer lolo ,and trying to stick to it. Also can I create property for DataGridView and use it as you did show for textBox and listBox and do the same thing? as my origional problem is to fill the DataGrid . Please Help.
Thanks,
class1
{
internal DataGridView DataView1 = new DataGridView();
}
class2
{
class1 fillData = new class1(); //This grid has two columns
for(int i = 0; i < someArr.Length; i++)
{
fillData.DataView1.Rows[0].Cells[0].Value = "ASIF";
fillData.DataView1.Rows[0].Cells[1].Value = "212-222-222";
}
}
A.Asif
|
|
|
|
|
From what I see, you need to bind some data to your DataGridView. I dont have enough informations to give you a complete answer but I will give you some pointers.
First, to add some data to your DataGridView, you should use the databinding and let .NET do the job for you.
Using a second class to access the data is a good idea. You should check some design idea and best practice in multi-tier applications and separate your data access, business logic and rendering (presentation layer). You will see that a lot of the things that relate to data access on .NET application already exist in the framework and you dont need to reinvent the wheel.
A very partial example could look like this :
class class1
{
internal DataGridView DataView1 = new DataGridView();
public Rebind()
{
DataAccessor cls = new DataAccessor();
DataView1.DataSource = cls.GetData();
DataView1.DataBind();
}
}
class DataAccessor
{
public DataSet GetData()
{
DataSet data =
return data;
}
}
See also
Hope that help.
|
|
|
|
|
There are many ways to do it, but IMO, it's best to separate the class (business object) from the UI, unless the class is specifically used for updating Form1.
myClass should provide data or values only, as public properties, it should be up to the form to retrieve the value from myClass, instead of myClass updating the UI elements directly.
class Form1
{
private myClass theClass;
public Form1()
{
theClass = new myClass();
theClass.DoSomeCalculation();
UpdateUI();
}
private void UpdateUI()
{
// Update ListBox from theClass.ListBoxValue
// Update TextBox from theClass.TextBoxValue
}
}
class myClass
{
public string[] ListBoxValue { get; set; }
public string TextBoxValue { get; set; }
public void DoSomeCalculation()
{
}
}
YMMV.
|
|
|
|
|
Hello everyone,
Is there any way that I can check to see my Windows Application on what Operating System is running? I am trying to see if the user is using XP or Vista.
Thank you very much for your help.
Khoramdin
|
|
|
|
|
Try with this:
System.OperatingSystem osInfo =System.Environment.OSVersion;
nemanja
|
|
|
|
|
I have a log that outputs a line like this;
BATTERY VOLTAGE RESTORED
Note the blank(whitespace) after the word RESTORED, and then an odd Ascii character at the end.
I need to eliminate everything after the word restored and terminate the line at that point.
Thanks,
|
|
|
|
|
You could iterate through the characters in the string L-R and check the ASCII code of each character. As soon as you find a character whose ASCII code is outside of a certain range e.g. not a letter or number, return a string containing all the characters up to but not including that character.
Alternatively, if you know that only the last character isn't needed, use String.Substring to return a string that contains every character in a line minus the last character.
Paul Marfleet
|
|
|
|
|
The problem with the L-R is that the ASCII is a random generated item. Not consistant for each entry.
I didn't think about the string.substring method. I will have to give that a look.
Thanks,
|
|
|
|
|
By L-R I mean process the string contents from left to right.
Check each character until you find one whose ASCII code that isn't valid for your purposes. Consult a table of ASCII codes to determine what the valid ranges might be.
Paul Marfleet
|
|
|
|
|
Got it. I think I can mangle it from here!
|
|
|
|
|
Hi I am getting Undefined value
My code is like this
Please help very urgent
ProfileData.ProfileRow profileRow = GetProfileRow(code, strYear);<br />
<br />
private ProfileData.ProfileRow GetProfileRow(int Code, string Year)<br />
{<br />
ProfileData.ProfileRow profileRow;<br />
DataRow[] dataRow = profileData.Profile.Select("code = " + Code + " AND eff_year = '" + Year + "'");<br />
if (Validation.ExistsWithRows(dataRow)) <br />
{<br />
profileRow = (ProfileData.ProfileRow)dataRow[0];<br />
}<br />
else <br />
{<br />
profileRow = null;<br />
}<br />
return profileRow;<br />
}
|
|
|
|
|
Rukmini T wrote: Hi I am getting Undefined value
Where?
Rukmini T wrote: Please help very urgent
It's rude to say this. Everyone's query is urgent. You have chosen to solicit help from a free site rather than pay for assistance so you should ask your questions politely and be prepared to wait for a response.
Paul Marfleet
|
|
|
|
|
I don't know why you are thinking that I am not polite.
I know that everyone quries are urgent. Don't think that
writing like this
"Please help very urgent" is rude. I am requesting for help
bcos I am really in need and fed up with undefined value.
And I am so surprise to see this type of message.
Anyways SORRY if I said something wrong.
|
|
|
|
|
Rukmini T wrote: I know that everyone quries are urgent. Don't think that
writing like this
"Please help very urgent" is rude.
Then why did you write it? Why state the obvious?
The basic fact of the matter is that it is considered rude to write "Please help very urgent" when posting a message in an online forum where people offer their help for free. If you say this, it is more likely that your message will be ignored.
Rukmini T wrote: And I am so surprise to see this type of message.
Don't be. If I hadn't have said it, someone else would.
Paul Marfleet
|
|
|
|
|
pmarfleet wrote: Then why did you write it? Why state the obvious?
I told you in my reply message that I am requesting for help
bcos I am really in need and fed up with undefined value.
Okay Thanks for letting me know that writing
"Please help very urgent" is rude in a free forum.
|
|
|
|
|
Rukmini T wrote: I told you in my reply message that I am requesting for help
bcos I am really in need and fed up with undefined value.
Everyone who posts a question is in need and has (presumably) exhausted all other lines of enquiry. While I can appreciate your frustration, you should realize that it is inappropriate to use such phrases when posting questions. Courtesy and patience are more likely to yield results.
Rukmini T wrote: Thanks for letting me know that writing
"Please help very urgent" is rude in a free forum.
No problem.
On the subject of your question, presumably there is something wrong with your query criteria. Have you tried stepping through your code in debug mode to check that your query criteria has been constructed correctly?
Paul Marfleet
|
|
|
|
|
Rukmini T wrote: very urgent
How rude.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
I know the size of player, i want to extract the YUV frames from a video file and want to play in a window
i did this with openGl, but i have no idea how to do it in c sharp
do anybody have any idea
i want to make it as simple as possible
|
|
|
|
|
How we are able to Design Patterns in C# Application?
---
Regards
ilango gandhi
|
|
|
|
|
ilango gandhi wrote: How we are able to Design Patterns in C# Application?
By writing C# code
|
|
|
|
|
Err...by writing code?
The following site[^] might help you though.
Paul Marfleet
|
|
|
|
|
Thanks
---
Regards
ilango gandhi
|
|
|
|
|
Be more specific, please.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
I'm learning C# and have been given an assignment with a flexible requirement of reading / writing to a file.
I'm thinking of trying XML as a possible format for saving and retrieving data.
I've tried googling this but a couple of the sites I've gone too look complicated (perhaps it's complicated because I don't know how to relate XML with C# ?)
Can anyone suggest a basic tutorials / website that a newbie like myself can reference for the purpose of writing and reading an xml file?
Thanks in advance.
|
|
|
|
|
The obvious place to start is by reading the Framework documentation for the XML-related classes on MSDN. It's pretty dry stuff, but there will be small samples to get you going.
I would also recommend TopXML[^]. I've found this site useful in the past when I've wanted to learn how to do something with XML in .NET.
Paul Marfleet
|
|
|
|