|
I'm not going to try to read all that -- reduce the problem to the minimum amount of code, then format it properly (use <pre></pre> tags as the instructions say).
|
|
|
|
|
Maybe it will be stupid question, but is this code:
Member 4674360 wrote: using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Assignmnet2
{
[Serializable]
class CreateEntry
{
ITECH3219Student student = new ITECH3219Student();
List<itech3219student> list_InsertStudent = new List<itech3219student>();
list_InsertStudent.Add(student);
}
}
copied directly from your code? If it is, then it's invalid (line list_InsertStudent.Add(student);)
You should add this line in the constructor.
|
|
|
|
|
that is unreadable due to the absence of <PRE> tags
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Sorry, could you repeat that my hearing is going?
It's time for a new signature.
|
|
|
|
|
Richard MacCutchan wrote: my hearing is going?
I'd better not; if I repeat that once more, it will be gone completely. I could send an e-mail though.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
The problem is in here:
public string Grade
{
get
{
int TotalMark = LabsMark + Ass1 + Ass2 + Final;
if (TotalMark < 40) return "F";
else if (((!Passed()) && TotalMark >=50) || // This line should contain another ')' after "TotalMark >= 50)"
(TotalMark < 50 && TotalMark >= 40))return "MF";
else if ((Passed()) && TotalMark < 60 && TotalMark >= 50)return "P";
else if ((Passed()) && TotalMark < 70 && TotalMark >= 60)return "C";
else if ((Passed()) && TotalMark < 80 && TotalMark >= 70)return "D";
else if (TotalMark > 80) return "HD";
else
return string.Empty;
}
}
|
|
|
|
|
You need to fix your compilation errors first. Other posters have pointed to some of them, the following code is obviously wrong
{
[Serializable]
class CreateEntry
{
ITECH3219Student student = new ITECH3219Student();
List<ITECH3219Student> list_InsertStudent = new List<ITECH3219Student>();
list_InsertStudent.Add(student);
}
}
This code needs to be enclosed by a method or constructor.
It's time for a new signature.
|
|
|
|
|
Hi all.
I've search a lot but i haven't find a code in c# that make a Client-Server net that work over internet.
All samples i found work only on LAN.
Can anyone please give me some link of sample that use a Client-Server net working over internet?
Thanks.
|
|
|
|
|
Member 4311057 wrote: I've search a lot but i haven't find
That's because it doesn't exist. If you want to connect applications via the internet then use WebServices.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Did you think about port forwarding? If you skip that on the server, the client can not connect to it.
|
|
|
|
|
I think the port are ok (they're opened i mean,i've open it in the firewall and they seems not to be blocked).
Mark,can you give me a sample were you use webService? (for example a chat)
A chat could be a great example becouse i can change the text message with the data i want to tranfer.
Thanks.
|
|
|
|
|
Ok,i've made a web service that do what i want,the problem is that i can see it only in local network.
How can i made it work (like Apache in PHP) from anywhere in internet ?
Thanks.
|
|
|
|
|
I have a simple C# application that performs some setup tasks and exits, once done, with no user notification. I would like to display a progress dialog showing status. Currently my setup code is in the Run method of the program instance.
I could create two forms. Form A would be not visible and would perform setup tasks. Form A would create Form B that displays progress. Form A could manipulate Form B controls.
This I could have done, but seems unnecessary and not proper. What I was trying to accomplish was including the setup code in the Run function of the program instance. And creating a single progress dialog there. But then I'm missing a message pump for forms? (is that correct wording). Form would not process paint events I'm guessing.
Am I over-thinking this? I would like to accomplish having a thread (maybe original app thread) processing setup tasks, and a separate thread or message pump for form? To accomplish this, I think would help me in understanding more about threading and app processing.
Thanks for your help!
|
|
|
|
|
David Hovey wrote: I could create two forms.
Asynchronous programming might be an answer to your problem.[^]
David Hovey wrote: Am I over-thinking this?
Possibly.
David Hovey wrote: To accomplish this, I think would help me in understanding more about threading and app processing.
That though is true.
My signature "sucks" today
|
|
|
|
|
Use a BackgroundWorker to do the long running tasks and use ReportProgress to update the ProgressBar .
Alternatively, use my ProgressWorker[^] which I made for exactly this purpose.
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
David Hovey wrote: Am I over-thinking this?
Yes. You don't need two forms or to use the Run method.
Have one form the displays the progress indicator and, as Davey, suggests use a Background worker to complete the tasks. Start the background operation from the FormLoad event.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
public void InsertPlannedMaterialMasterRequest(int id, string requestDocument, string requestDescription, string requestType, string hodApproval, int companyCode, string hodRemarks, string det_Description, string name, int qty, string code)
{
string query = "INSERT INTO MasterRequest (ID,Req_Document,Req_Description,ReqType,HODApproval,CompanyCode,HODRemarks) VALUES (@ID,@Req_Document,@Req_Description,@ReqType,@HODApproval,@CompanyCode,@HODRemarks)";
SqlConnection con = new SqlConnection(constr);
SqlCommand com = new SqlCommand(query, con);
com.Parameters.Add("@ID", SqlDbType.Int).Value = id;
com.Parameters.Add("@Req_Document", SqlDbType.NVarChar).Value = requestDocument;
com.Parameters.Add("@Req_Description", SqlDbType.NVarChar).Value = requestDescription;
com.Parameters.Add("@ReqType", SqlDbType.NVarChar).Value = requestType;
com.Parameters.Add("@HODApproval", SqlDbType.NVarChar).Value = hodApproval;
com.Parameters.Add("@CompanyCode", SqlDbType.Int).Value = companyCode;
com.Parameters.Add("@HODRemarks", SqlDbType.NVarChar).Value = hodRemarks;
con.Open();
com.ExecuteNonQuery();
con.Close();
string query2 = "INSERT INTO DetailRequest (ID,Req_Document,Description,Approval) VALUES (@ID,@Req_Document,@Description,@Approval)";
SqlConnection con2 = new SqlConnection(constr);
SqlCommand com2 = new SqlCommand(query2, con2);
com2.Parameters.Add("@ID", SqlDbType.Int).Value = id;
com2.Parameters.Add("@Req_Document", SqlDbType.NVarChar).Value = requestDocument;
com2.Parameters.Add("@Description", SqlDbType.NVarChar).Value = det_Description;
com2.Parameters.Add("@Approval", SqlDbType.NVarChar).Value = hodApproval;
con2.Open();
com2.ExecuteNonQuery();
con2.Close();
string query3 = "INSERT INTO ITEMS (ID,Code,Name,Quantity) VALUES (@ID,@Code,@Name,@Quantity)";
SqlConnection con3 = new SqlConnection(constr);
SqlCommand com3 = new SqlCommand(query3, con3);
com3.Parameters.Add("@ID", SqlDbType.Int).Value = id;
com3.Parameters.Add("@Code", SqlDbType.NVarChar).Value = code;
com3.Parameters.Add("@Name", SqlDbType.NVarChar).Value = name;
com3.Parameters.Add("@Quantity", SqlDbType.Int).Value = qty;
con3.Open();
com3.ExecuteNonQuery();
con3.Close();
}
protected void Button1_Click(object sender, EventArgs e)
{
MasterRequest_DAL helper = new MasterRequest_DAL();
PlannedMaterialRequest pnd = new PlannedMaterialRequest();
ItemsHandling itm = new ItemsHandling();
string[] labelName = new string[100];
string[] coder = new string[100];
string[] quantity = new string[100];
if (TextBox6.Text != "0")
{
labelName[1] = itm.Code(0).ToString();
labelName[2] = TextBox6.Text;
helper.InsertPlannedMaterialMasterRequest(Convert.ToInt32(TextBox1.Text), TextBox2.Text, TextBox4.Text, DropDownList6.SelectedValue, DropDownList2.SelectedValue, Convert.ToInt32(TextBox11.Text), TextBox12.Text, TextBox13.Text, Label8.Text, Convert.ToInt32(TextBox6.Text), labelName[1]);
}
if (TextBox12.Text != "0")
{
labelName[1] = itm.Code(1).ToString();
labelName[2] = TextBox12.Text;
helper.InsertPlannedMaterialMasterRequest(Convert.ToInt32(TextBox1.Text), TextBox2.Text, TextBox4.Text, DropDownList6.SelectedValue, DropDownList2.SelectedValue, Convert.ToInt32(TextBox11.Text), TextBox12.Text, TextBox13.Text, Label12.Text, Convert.ToInt32(TextBox8.Text), labelName[1]);
}
}
The problem I am facing is that using the above code. The ID goes multiple times in MasterRequest table which should go only once, while the same ID must go to Items table multiple times as per the quantities being entered. I want only the ID to go into MasterRequest table just once not multiple times.
|
|
|
|
|
Hello all!
I'm new to asp.net and i'm trying to bind some XML data to a gridview.
abviously I'm not understanding how to do it properly because that my code doesn't seem to
work...Can anyone could help me please?
this is my xml:
#########################################
<?xml version "1.0" encoding "utf-8"?>
<dictionary>
<item>
<key>
<string> hello world </string>
</key>
<value> <anytype xmlns:q1="http://www.w3.org/2001/XMLSchame" d4p1:type="q1:int"
xmlns:d4p1="http-instance">45</anytype>
</value>
</item>
</dictionary>
and this is my code:
########################################
string path = "D:\\myXmlFile.xml";
DataSet oDs = new DataSet();
ods.ReadXml(path);
GridView1.DataSource = dataSet;
GridView1.DataBind();
thanks
Tom
|
|
|
|
|
Please do not post into multiple forums.
It's time for a new signature.
|
|
|
|
|
I have a code which generated dynamic gridviews based on a column ('c_AnalyticalSystemID"). Now I have a samll problem in passing cell parameter into a textbox which I clicked on a datagridview.
the code is :
private void button1_Click(object sender, EventArgs e)
{
string query = "select t.c_AnalyticalSystemID,t.c_RetentionTime,t.c_IonType , t.c_MSstage, k.c_MSstage, t.c_IonFormula, k.c_IonCharge, t.c_IonMass as 'Mass', t.c_MinArea, t.c_UserID_stamp,c_Time_Stamp,k.c_IonTypeRule from C_Analytical_Type1 t join C_AnalyticalSystems c on t.c_analyticalsystemid = c. c_analyticalsystemid join C_Analytical_Type1_IonTypes k on k.c_iontype = t.c_iontype where t.c_id=" + Convert.ToInt32(textBox1.Text.ToString()) + "";
DataTable dt_cmbo_ = new DataTable();
OdbcDataAdapter cmbo_ = new OdbcDataAdapter("SELECT c_IonCharge,c_IonType,c_IonTypeExplained from C_Analytical_Type1_IonTypes", OdbcCon);
dt_cmbo_.Columns.Clear();
dt_cmbo_.Rows.Clear();
cmbo_.Fill(dt_cmbo_);
OdbcCommand cmd = new OdbcCommand(query, OdbcCon);
OdbcDataReader dr = cmd.ExecuteReader();
DataTable dt1 = new DataTable();
dt1.Load(dr);
int margin = 30;
Point pt = new Point(margin, margin);
panel1.Controls.Clear();
DataTable distinctSystemIDs = dt1.DefaultView.ToTable(true, "c_AnalyticalSystemID");
// DataTable ion = dt.DefaultView.ToTable(true, "c_IonTypeExplained");
for (int i = 0; i <= distinctSystemIDs.Rows.Count -1; i++)
{
int systemID = (int)distinctSystemIDs.Rows[i][0];
DataGridView dgw = new DataGridView();
Label l = new Label();
l.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
l.Location = pt;
l.Text = "System " + systemID.ToString();
pt.Y += l.Height + 2; // margin is for spacing between grids
dgw.Tag = systemID; // store systemID of the DGV if you need it later
dgw.AllowUserToAddRows = false;
dgw.AllowUserToDeleteRows = false;
dgw.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
dgw.Size = new Size(730, 100); // 2 * margin = left + right margin
dgw.Location = pt;
pt.Y += dgw.Height + margin; // margin is for spacing between grids
//this.Controls.Add(dgw);
// dgw.Columns["c_IonTypeRule"].Visible = false;
//dgw.Columns["c_AnalyticalTypeExplained"].Visible = false;
// dgw.Columns["c_ID"].Visible = false;
cmdx.Name = "IonType";
cmdx.DataPropertyName = "c_IonType";
cmdx.HeaderText = "IonType";
cmdx.Width = 80;
cmdx.DataSource = dt_cmbo_;
cmdx.ValueMember = "c_IonType";
cmdx.DisplayMember = "c_IonTypeExplained";
//c_IonTypeRule cmdx.DisplayMember = " c_IonCharge";
panel1.Controls.Add(dgw);
panel1.Controls.Add(l);
dgw.Columns.Add(cmdx);
DataView vw = new DataView(dt1, string.Format("c_AnalyticalSystemID = {0}", systemID), null, DataViewRowState.CurrentRows);
dgw.DataSource = vw;
dgw.Columns["c_AnalyticalSystemID"].ReadOnly = true;
// dgw.Rows[i].Cells["IonCharge"].Value = textBox1.Text;
dgw.Columns[3].Visible = false;
int k = 0;
}
}
private void dgw_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
try
{
DataGridViewRow row = new DataGridViewRow();
//DataGridView dgw = new DataGridView();
row = dgw.Rows[e.RowIndex];
// d2 = 1;
// Will put the value of the first column of the selected row into the textbox
textBox60.Text = row.Cells[e.ColumnIndex].Value.ToString();
}
Is it correct what I'm doing to get the value of cell into a textbox when clicked on a paticular datagridview.
The main aim was to edit a record and my head wants to have a single button, so I thought of passing values to textboxs which they want to edit by clicking on that record of that gridview generated automatically. Can you give me an idea how to do this or is there any other way?
Srikanth
|
|
|
|
|
I am new to .Net , I have developed an application using C#.I want check the code quality of my application .Can any one suggest any tool ,which perform code quality check?
|
|
|
|
|
FxCop can do some preliminary (actually more the preliminary - if your rules are set right) analysis.
My signature "sucks" today
modified on Saturday, May 22, 2010 7:24 AM
|
|
|
|
|
There are two tools you can go with (simultanously):
1. FxCop (as mentioned by "Abhinav S").
2. StyleCop
The first one checks if your code conforms to rules Microsoft established for .NET applications design (for example methods, that don't use classes should be declared as static, all fields should be private).
The second one checks your code style (members should be commented, there should be single empty line between members).
Some of rules (like naming rules) are common for both those tools, some can only be found in one of them. Both are great way to learn to write clean and maintainable code.
|
|
|
|
|
StyleCop is new to me
I will download and test
Thanks
Life's Like a mirror. Smile at it & it smiles back at you.- P Pilgrim
So Smile Please
|
|
|
|
|
As it's my first post here I should probably say "Hello"
In WinForms application I'm developing I'd like to have a Panel (let's name it "controlContent"), that should be editable in inherited classes (I want to add controls to it) and second Panel, that will have some buttons common to all controls in this hierarchy. The problem is that when I do it the simplest way - by setting controlContent to be protected - StyleCop says, that field should not be protected, create property instead. Well obviously he's right. But when I create what he want's I don't have access through Visual Studio designer to the Panel. And of course I don't wan't to write controls' layout manually.
Did anyone have similar issue? How can I solve it? (I was searching web, but either I'm asking google wrong questions or answer isn't there).
|
|
|
|
|