|
Hi every1,
I am working with lists and faced with a problem.
this is the method in my first class which has implemented in DAL
namespace Assignmnet2
{
[Serializable]
class Student_Manipulation
{
public void ReadStudentFile(string Fr_Name, string Sr_Name, string St_Id, int Lb_Mark, int Ass1, int Ass2, int
Fnl)
{
FileStream flstream = new FileStream("c:\\student.dat",FileMode.Open,FileAccess.Read);
BinaryFormatter BnFrmt = new BinaryFormatter();
List<ITECH3219Student> list = (List<ITECH3219Student>)BnFrmt.Deserialize(flstream);
foreach (ITECH3219Student ITECH3219Student in list)
{
Fr_Name = ITECH3219Student.Fr_name;
Sr_Name = ITECH3219Student.Sr_Name;
St_Id = ITECH3219Student.St_Id;
Lb_Mark = ITECH3219Student.Lb_Mark;
Ass1 = ITECH3219Student.Ass1;
Ass2 = ITECH3219Student.Ass2;
Fnl = ITECH3219Student.Fnl;
}
}
}
-------------------
In BLL I have this class
namespace Assignmnet2.BLL
{
class Finalization
{
public void read(string Fr_Name, string Sr_Name, string St_Id, int Lb_Mark, int Ass1, int Ass2, int Fnl)
{
Assignmnet2.Student_Manipulation read = new Assignmnet2.Student_Manipulation();
read.ReadStudentFile(Fr_Name, Sr_Name, St_Id, Lb_Mark, Ass1, Ass2, Fnl);
}
}
}
----------------------
Now, in peresentation layer I have this code
private void Form1_Shown(object sender, EventArgs e)
{
Assignmnet2.BLL.Finalization ReadStudent = new Assignmnet2.BLL.Finalization();
LstBox.Items.Add(ReadStudent(ITECH3219Student.Fr_name + " " + ITECH3219Student.Sr_Name + " " +
ITECH3219Student.St_Id));
----------------
Frankly, I don't really know what I supposed to write in this layer in order to show file's information in listbox.
Could you please help me?thanx
modified on Wednesday, May 26, 2010 8:52 AM
|
|
|
|
|
Please edit your question to put your code between <pre>... your code here ....</pre> tags.
I for one will not even attempt to read such unformatted code. It hurts my eyes!!
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.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.
|
|
|
|
|
|
That is still not readable.
Firstly, do it by editing your original question, not by answering this.
Secondly, put the <pre> tag before your code and the </pre> tag after your code. Then format the code, indents etc..
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.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.
|
|
|
|
|
Guys, Could you please help me how Can I sort out my prob.thx
|
|
|
|
|
OK. That is much better.
In your ReadStudentFile(string Fr_Name, string Sr_Name, string St_Id, int Lb_Mark, int Ass1, int Ass2, int Fnl) , what are the parameters (Fr_Name, Sr_Name etc.) supposed to be for? You are not using them to pass data in and they are not configured to return data and even if they were they would only return the last student in the list.
Unless I have totally misread your code ReadStudentFile would be better as something like:
public List<ITECH3219Student> ReadStudentFile(string Fr_Name, string Sr_Name, string St_Id, int Lb_Mark, int Ass1, int Ass2, int Fnl)
{
FileStream flstream = new FileStream("c:\\student.dat",FileMode.Open,FileAccess.Read);
BinaryFormatter BnFrmt = new BinaryFormatter();
List<ITECH3219Student> list = (List<ITECH3219Student>)BnFrmt.Deserialize(flstream);
return list;
}
Your Assignment2.BLL would also need to be rewritten to return the List<ITECH3219Student> , once again no obvious need for the parameters.
and then in your Form1_Shown something like
private void Form1_Shown(object sender, EventArgs e)
{
Assignmnet2.BLL.Finalization ReadStudent = new Assignmnet2.BLL.Finalization();
List<ITECH3219Student> studentList = ReadStudent.read();
foreach (ITECH3219Student student in studentList)
{
LstBox.Items.Add(student.Fr_name + " " + student.Sr_Name + " " + student.St_Id));
}
}
This should work, although I have to say that the slightly 'artificial' way that you have divided the functionality between the various classes indicates that you have not really understood the assignment.
Good luck!
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.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.
|
|
|
|
|
Ummmm....homework?!?!?! Why did you provide an answer to this that included an implementation? Did you not notice that his namespace is "Assignment2" ?
"I need build Skynet. Plz send code"
|
|
|
|
|
What can I say? I'm in a good mood today.
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.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.
|
|
|
|
|
Hi,
I really appreciate for your reply.I realized my problem in first part, as you said.
still I am confusing regarding this line
Your Assignment2.BLL would also need to be rewritten to return the List, once again no obvious need for the parameters.
Could you please explain a little more. why I don't need parameter?
Thanks in advance.
|
|
|
|
|
You don't need the parameters because you aren't using them.
As I said in my previous reply, you are not passing any data in them and they are not configured to return any data.
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.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.
|
|
|
|
|
Hi Every One,
I write this code and as you said I fixed it up(Follow your instruction).
but I got a problem
Error1: Cannot implicitly convert type 'string' to 'System.Collections.Generic.List<Assignmnet2.ITECH3219Student>' C:\Assignmnet2\Frm_View.cs
Error2: 'Assignmnet2.BLL.Finalization.read()': not all code paths return a value C:\Assignmnet2\BLL\Finalization.cs
Error3: Since 'Assignmnet2.Student_Manipulation.ReadStudentFile()' returns void, a return keyword must not be followed by an object expression C:\Assignmnet2\DAL\Student_Manipulation.cs
this is the code which I have modified it.
class studentmanipulation which is in DAL
public void ReadStudentFile()
{
FileStream flstream = new FileStream("c:\\student.dat", FileMode.Open, FileAccess.Read);
BinaryFormatter BnFrmt = new BinaryFormatter();
List<ITECH3219Student> list = (List<ITECH3219Student>)BnFrmt.Deserialize(flstream);
return list;
}
------------------------------------
Class finalization which is in BLL
public string read()
{
Assignmnet2.Student_Manipulation read = new Assignmnet2.Student_Manipulation();
read.ReadStudentFile();
}
----------------------------
and Presentation Layer which is my form
private void Form1_Shown(object sender, EventArgs e)
{
Assignmnet2.BLL.Finalization ReadStudent = new Assignmnet2.BLL.Finalization();
List<ITECH3219Student> studentList = ReadStudent.read();
foreach (ITECH3219Student student in studentList)
{
LstBox.Items.Add(student.Fr_name + " " + student.Sr_Name + " " + student.St_Id);
}
}
|
|
|
|
|
I just finished a graphical password system and want to use it on my computer instead of the winlogon. Can anyone offer help
|
|
|
|
|
Windows XP, 2000 and server 2003 use a system called Graphical Identification and Authentication (or GINA). It is possible to replace the default MSGina.dll with a custom dll to customize the login and authentication process.
You can read more about GINA and the Winlogon system on MSDN[^].
Windows Vista, 7 and server 2008 no longer use GINA. Instead Winlogon controls the logon process and allows custom credential providers.
Again, there is lots of information about custom credential providers on MSDN[^].
You might also want to read the wikipedia articles on Winlogon[^] and GINA[^] for some basic background info.
You are asking this in the C# forum, but this kind of windows integration is going to need to be done largely (if not completely) in an unmanaged language. There is an MSDN magazine article on custom credential providers that should get you started[^].
Simon
|
|
|
|
|
Some useful information here[^]; it's amazing what you can find when you try looking.
It's time for a new signature.
|
|
|
|
|
and you cannot replace GINA with managed code, i.e.: a C# .DLL.
|
|
|
|
|
I would like to fill a class from a text file as struture:
1000, n, km 5
description
and so on
knowing that the two lines represents a line of Class
then how to assign each value (1000, n ,...) for each variable in the class???
thank you in advance
|
|
|
|
|
Read the text file, parse the data, and add it to objects of your class. You can create your objects either by a constructor or by setters for specific properties.
Which part of this are you having difficulty with?
It's time for a new signature.
|
|
|
|
|
in the parse the data where I have the problem, I used to read the file:
string[] lines = System.IO.File.ReadAllLines(@"file.txt");
foreach (string line in lines)
{
Console.WriteLine("\t" + line);
}
|
|
|
|
|
Well that's very interesting but what is the problem?
It's time for a new signature.
|
|
|
|
|
i d'ont know how to parse the data from de file line by line, if you can complete the code , thank you
|
|
|
|
|
tek 2009 wrote: i d'ont know how to parse the data from de file line by line, if you can complete the code , thank you
Good try, but we are not here to write your programs for you. Take a look at the System.String[^] class and make use of some of its methods to get the results you are looking for. If you really don't know how to get started then try working through this book[^] which contains lots of useful tutorials.
It's time for a new signature.
|
|
|
|
|
Hi All,
I have a Form with a Datagridview. The datagridview contains more columns than in the visible area.
Now to my problem:
If I scroll to the right of the datagridview and then select a row or multiple rows the datagridview moves to the left so that the first columns are in the visible area. I would like to keep the columns currently shown to stay in the visible area.
I hope my question is clear and someone can help me.
Thanks
Andre
|
|
|
|
|
It is default behavior of datagridview control.
You cannot change it.
There are two tricks to avoid it.
1. You need to minimize the number of columns to display by hiding some of the columns.
DataGridView1.Columns[2].Visible=False;
2. You can change the order of columns so that the columns that require to be visible
for selecting rows comes first so no need to scroll to right side of the grid.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
|
Do not cross post in multiple forums. It is considered rude and make it very difficult to colaborate on answers.
I already answered your question in the VB.NET forum.
|
|
|
|