|
Sh*t bro. How dumn is this. I found thousands of xml files, but I cant copy them to another folder. It says 'Cannot move file: Cannot read from the source file or disk'. That is when I want to copy all of them to another folder. Strange!
|
|
|
|
|
I think I know this one. Leave away files coming from the Temporary Internet Files (or something similar) directory.
Good luck!
|
|
|
|
|
Hi all,
I Have Core Project [3 tier Presentation-business-Data] include Core
functionality, I want to reuse the Core Business functions in another
project because the 2 projects using the same database.
Lets Say this is the Case:
CoreProject: Presentation->business->Data->DB
NewProject: Presentation->business->Data->DB
and
Presentation->CoreProject.business->CoreProject.Data->DB
My Question Is: How and where to add the Core business DLL in the new
project? And in case I want to add the Core business DLL reference to
the New Project Presentation there is conflict because of 2 businesses
DLL (the same name).
Thanks
Ashraf
Ashraf
|
|
|
|
|
I am new to c# and oop. I seem to be missing something here. I don't understand why I can't access a function from my Form instance (Form1) from another class in the same namespace. Why does it not recognise the Form1 instance?
Here is my code - the problem is when trying to access Form1.SetFormData(); in the NumberProcessing class.
Could you please insert the correct code where necessary to make it work so I can fully understand what I need to do.
namespace RouletteV1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btn1_Click(object sender, EventArgs e)
{
NumberAttributes.Load(1);
}
public void SetFormData()
{
//here is where I will set the textbox properties
textBox1.Text = "Hello";
}
}
}
--------------
namespace RouletteV1
{
public static class NumberAttributes
{
public void Load(short Number)
{
// load the number data into global properties here
NumberProcessing.UpdateNumArray();
}
}
---------------
namespace RouletteV1
{
public static class NumberProcessing
{
public void UpdateNumArray()
{
// Here I want to call the SetFormData()function in Form1 but it won't recognise it - why???
Form1.SetFormData();
}
}
}
Thanks in advance for your help
Haz
|
|
|
|
|
Becouse you are trying to access a non static class from a static class... it's not possible in C#.
I don't know how can I help you now, maybe someone else can.
|
|
|
|
|
Can anyone else help me with this?
Haz
|
|
|
|
|
The method SetFormData() can only be performed on an instance of a Form1 object. One way to achieve this is to pass UpdateNumArray() a reference to a Form1 object, as in:
public void UpdateNumArray
(Form1 theForm)
{
theForm.SetFormData();
}
/ravi
|
|
|
|
|
Thanks for that, everything has just clicked!!!! I understand where I was going wrong!! Fundamentals of oop
Haz
|
|
|
|
|
Glad you're up and running!
/ravi
|
|
|
|
|
Wrong. The problem is he's trying to access the non-static method on the Form1 class instead of an instance of Form1.
The class trying to access an instance of Form1 can only get a reference to the instance of Form1 if it creates the form instance, or the form gives the using class an instance of itself.
The following will work, but it's not a very wise design decision to allow processing classes to has instances of your Form. Better to have you working classes just do work with data and return values that your UI can use.
namespace RouletteV1 {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void btn1_Click(object sender, EventArgs e) {
NumberAttributes.Load(this, 1);
}
public void SetFormData() {
textBox1.Text = "Hello";
}
}
public static class NumberAttributes {
public void Load(Form1 form, short Number) {
NumberProcessing.UpdateNumArray(form);
}
}
public static class NumberProcessing {
public void UpdateNumArray(Form1 form) {
form.SetFormData();
}
}
}
-- modified at 11:46 Monday 24th July, 2006
Whoever voted this message down can kiss my hairy white ass, unless they'd like to actually post something to refute it.
|
|
|
|
|
Thanks a lot for that, you were exactly right! I have slightly altered my code to cut down on the form reference passing. However when I try compling it it throws up an error - Compiler Error CS0120 - Error Message
"An object reference is required for the nonstatic field, method, or property 'member' " and refers to line
NumberProcessing.UpdateNumArray(this);
I am guessing there is a problem with the "this" value?
Any suggestions what is wrong??? Code is below.
namespace RouletteV1<br />
{<br />
public partial class Form1 : Form<br />
{<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
} <br />
<br />
private void btn1_Click(object sender, EventArgs e)<br />
{<br />
NumberAttributes.Load(1);<br />
NumberProcessing.UpdateNumArray(this);<br />
}<br />
<br />
public void SetFormData()<br />
{<br />
tboxNumArray.Text = "Hello";<br />
} <br />
<br />
public class NumberProcessing<br />
{<br />
<br />
public void UpdateNumArray(Form1 form)<br />
{<br />
form.SetFormData(); <br />
} <br />
}<br />
}
Thanks in advance for your help
Haz
|
|
|
|
|
Forget that I had missed off the static keyword for a method in one of the static classes. Only just realised that all static classes should have static members.
Thanks again for your help
Haz
|
|
|
|
|
well I just wanted to know, Can u place another datagrid inside one datagrid. I'm talking abt System.Windows.Forms here.
the other thing is that I wanted to do that bcz I wanted to display and receive data for a sales form. It has dat comming from 5 related tables. I had this idea but can any one of u give me some better idea of making a v user friendly interface. the tables are Prodline, prodmodel, Bill, purchase and customer.
Its basically for a coomputer shop. Can Anyone help?
I'm working in .net 1.1 mind u
-- modified at 8:40 Saturday 22nd July, 2006
|
|
|
|
|
Why do you need "nested datagrids" at the first place ? Believe me, users hates anything that doesn't not comply with their expectations and giving them that kind of interface won't take you to the right place.
Instead of creating a mess from the five tables on the one form I would consider adding a buttons/hyperlinks inside of the data rows. Clicking on particular button user navigates to the new form (or opens a e.g. combobox) with the data from linked table (prodline, prodmodel, etc).
|
|
|
|
|
Many thanks. I was also thinking on almost teh same lines but can u tell me if we can make combo boxed inside of datagrid column.
|
|
|
|
|
To put a combo box into a datagrid you should specify that particular columns (which
you'd like to be combobox-enabled) should be created using the DataGridComboBoxColumnStyle.
|
|
|
|
|
well I'm working in .Net version 1.1 which I think doesnt have anything such as DataGridComboBoxColumnStyle so what can I do now...
|
|
|
|
|
Hi,
I want to put the value of a column from a row in a datatable where I know the row number ie
string CName = [row=1, column=Names in datatable=dtClubs]
What goes into the [ .....] part?
TIA
Glen Harvy
|
|
|
|
|
DataSet dsTemp = new DataSet(); <br />
DataTable Tables = new DataTable(); <br />
dsTemp.Tables.Add(Tables);<br />
string data = dsTemp.Tables[0].Rows[0][0].ToString();
|
|
|
|
|
|
DataSet dsTemp = new DataSet();
DataTable dtMyClub= new DataTable();
dsTemp.Tables.Add(dtMyClub);
string data = dsTemp.Tables[0].Rows[0]["ClubName"].ToString();
//result
// string data = "North Ponly Club"
or can u set here ur piece code to see what are u want to do
-- modified at 9:06 Saturday 22nd July, 2006
|
|
|
|
|
Thanks for the help.
I need to work out a couple of other things as well.
Glen Harvy
|
|
|
|
|
Hi,
I am facing an odd problem. I have library class that fills up binary data in a string that is passed by ref to one of its function. The problem is when i convert the data into byte[] using the function System.Text.Encoding.Uncode.GetBytes();
I dont get the actual binary data which the library program has given to me.
I checked the length of the string before converting it into byte and it was the same as was sent by the library program. But when i convert it into byte[], not only the size is different but also the data is changed. I think some of the characters in the data are not valid Unicode data.
Is there any othe method which can give me the raw byte[] without applying any encoding scheme.
Like: byte[] GetByteData(string strData);
Regards
-Mursil
Take a very good care of Yourself.
Sayed Ahmad Mursil
|
|
|
|
|
Hello
There are more encoders than just Unicode. Did you try them?? Including Encoding.Default
You wouldn't want to put your string in a for loop and read it byte by byte, would you?
Regards
|
|
|
|
|
I have tried this method also.
But Encoding.Default basically returns Unicode encoding reference by default.
so it doesnot server the purpose.
Is there any open source library for other encoders.?
i.e which doesnt encode any thing. Just give me the exact byte[] stored in the string.???
Take a very good care of Yourself.
Sayed Ahmad Mursil
|
|
|
|