|
10 bucks says it falls down!
Ninja (the Nerd)
Confused? You will be...
|
|
|
|
|
You could always... cheat.
Fonts, all they are a little pictures really. What is it, courier new that compilers mostly use?
Anyway, see if you can get yourself that font, edit out some symbol that is allowed, and make it a number.
To the user, the first letter in the variable name is a number, but to the compiler its just a symbol, or another letter.
Oh, by the way, cheating is bad. Don't do it
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
Hi All,
I have a Form in and a class, I need to access a control on Form1 from a other class. So i can populate the data in those control using other class. Please Help! if possibile please show some code.
I.e--> //Both classes in same project
class Form1
{
//All control in this class
ListBox list1 = new ListBox();
TextBox box1 = new TextBox();
}
class myClass
{
//Need to access a control of Form1 and fill with data, lets say we want fill list1 and set bo1.Text =
}
A.Asif
|
|
|
|
|
There is more than one way to do this. It depend on the context.
I will show you 2 way, the first one is simple if the class only update this form and they are closely related. The other is an exemple for a class that can update this data in differents forms that can have differents controls but the same data.
***** Example 1:
<br />
class Form1<br />
{<br />
<br />
private ListBox list1 = new ListBox();<br />
private TextBox box1 = new TextBox();<br />
<br />
public ListBox List1 {<br />
get { return list1;}<br />
}<br />
<br />
public TextBox Box1{<br />
get { return box1;}<br />
}<br />
<br />
<br />
<br />
}<br />
<br />
class myClass<br />
{<br />
UpdateForm1(Form1 frm)<br />
{<br />
frm.List1.Items.Add("TEST");
frm.Box1.Text = "TEST";<br />
}<br />
<br />
}<br />
***** Example 2:
<br />
interface IUpdateForm<br />
{<br />
UpdateData(string[] items, string newText);<br />
}<br />
<br />
class Form1 : IUpdateForm<br />
{<br />
<br />
private ListBox list1 = new ListBox();<br />
private TextBox box1 = new TextBox();<br />
<br />
public Form_Load()<br />
{<br />
new myClass().UpdateForm(this);<br />
}<br />
<br />
public UpdateData(string[] items, string newText)<br />
{<br />
this.list1.Items.Add(items);<br />
this.box1.Text = newText;<br />
<br />
}<br />
<br />
}<br />
<br />
class myClass<br />
{<br />
UpdateForm(IUpdateForm uptFrm)<br />
{<br />
uptFrm.UpdateData(someArray, someText);<br />
}<br />
<br />
}<br />
There are more possibilities but theses two examples will give you the idea.
|
|
|
|
|
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
|
|
|
|