ASP.net - Getting table index on html table when button clicked - c#

I have the following code which populates an html table from data retrieved from Parse.com.
As you can see the table has buttons in it which are generated as the table gets populated. When clicked, obviously the buttons need to perform an action related to that row of data.
Can anybody help me with the click event please, specifically getting the row index?
At the moment the click event doesn't even seem to trigger the "response.Write" alert. (i'm very new to asp.net though)
using Parse;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
namespace FrogPointCMS
{
public partial class Beacons : System.Web.UI.Page
{
string merchantName;
string myMerchantID;
ParseObject merchantObject;
protected void Page_Load(object sender, EventArgs e)
{
merchantName = Request.QueryString["user"];
myMerchantID = Request.QueryString["merchantID"];
merchantObject = (ParseObject)Session["Merchant"];
getBeacons();
}
public async void getBeacons()
{
MyParseQueries myQuery = new MyParseQueries();
var myBeacons = await myQuery.getMyBeacons(merchantObject);
foreach (ParseObject beacon in myBeacons)
{
string aliasName = "";
string offerType = "N/A";
string offerTitle = "";
string offerDescription = "";
var merchantOb = beacon.Get<ParseObject>("merchantObjectId");
var merchantID = merchantOb.ObjectId;
if (merchantID == myMerchantID)
{
if (beacon.ContainsKey("contentObjectID"))
{
ParseObject content = beacon.Get<ParseObject>("contentObjectID"); // get the content object from parse.
offerType = content.Get<string>("offerType");
offerTitle = content.Get<string>("offerTitle");
offerDescription = content.Get<string>("offerDescription");
}
aliasName = beacon.Get<string>("aliasName");
Button assignNameBtn = new Button();
assignNameBtn.ID = "assignName";
assignNameBtn.Text = "Assign Name";
assignNameBtn.Click += assignNameBtn_Click;
Button assignActionBtn = new Button();
assignActionBtn.ID = "assignAction";
assignActionBtn.Text = "Assign Action";
var tr = new HtmlTableRow();
var checkBox = new HtmlTableCell();
var tableCellName = new HtmlTableCell();
var tableCellButton1 = new HtmlTableCell();
var tableCellButton2 = new HtmlTableCell();
var tableCellAction = new HtmlTableCell();
checkBox.InnerHtml = "<input type=\"checkbox\"/>";
tableCellName.InnerText = aliasName;
tableCellButton1.Controls.Add(assignNameBtn);
tableCellButton2.Controls.Add(assignActionBtn);
tableCellAction.InnerText = offerType + " - " + offerTitle + " - " + offerDescription;
tr.Cells.Add(checkBox);
tr.Cells.Add(tableCellName);
tr.Cells.Add(tableCellButton1);
tr.Cells.Add(tableCellAction);
tr.Cells.Add(tableCellButton2);
beaconTable.Rows.Add(tr);
}
}
}
void assignNameBtn_Click(object sender, EventArgs e)
{
Response.Write("<script type=\"text/javascript\">alert('Button clicked');</script>");
var btn = (Button)sender; // testing
HtmlTableRow row = (HtmlTableRow)btn.NamingContainer; //testing
}
}
}

If you want to do javascript stuff when clicking a button, use OnClientClick
Button b = new Button();
b.OnClientClick = "FunctionName"
And then in the html
<script>
function FunctionName() {
alert('Button clicked');
}
</script>

Related

Is there any solution "Gridview shows only one data after update new entry."?

Every time when I click the button only one row will be displayed. But it should show multiple rows. I declare the list after the constructor invoke. I tried with gridview.update() and gridview.refresh() but they didn't work. I could not findout the issue.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using JournalEntryApp.Model;
namespace JournalEntryApp
{
public partial class NewDocument : Form
{
public NewDocument()
{
InitializeComponent();
}
List<JEFrom> JEFromsList = new List<JEFrom>();
List<JETo> JETosList = new List<JETo>();
JEFrom _jef = null;
private void NewDocument_Load(object sender, EventArgs e)
{
label4.Text = DateTime.Now.ToString("dd-MMM-yyyy");
using (var db =new JournalContext())
{
unitComboBox.DataSource = db.Units.ToList();
unitComboBox.ValueMember = "Id";
unitComboBox.DisplayMember = "UnitName";
}
}
private void addToListButton_Click(object sender, EventArgs e)
{
if (string.Empty== fromAccountTextBox.Text)
{
MessageBox.Show("From Account can not be empty!!!");
}
else if (string.Empty == toAccountTextBox.Text)
{
MessageBox.Show("To Account can not be empty!!!");
}
else
{
_jef = new JEFrom{ FromEntryName= fromAccountTextBox.Text , FromEntryDate= DateTime.Now };
JEFromsList.Add(_jef);
temporaryDataGridView.DataSource = JEFromsList;
fromAccountTextBox.Text = string.Empty;
toAccountTextBox.Text = string.Empty;
}
}
}
}
The temporaryDataGridView cannot detect that you have changed the DataSource. It will only refresh when Datasource has changed.
temporaryDataGridView.DataSource = null;
temporaryDataGridView.DataSource = JEFromsList;
so change the Datasource null first.
Or you can use bindingSource
private void NewDocument_Load(object sender, EventArgs e)
{
this.bindingSource1.DataSource = JEFromsList;
temporaryDataGridView.DataSource = this.bindingSource1;
label4.Text = DateTime.Now.ToString("dd-MMM-yyyy");
using (var db =new JournalContext())
{
unitComboBox.DataSource = db.Units.ToList();
unitComboBox.ValueMember = "Id";
unitComboBox.DisplayMember = "UnitName";
}
}
in button_click
JEFromsList.Add(_jef);
bindingSource1.ResetBindings(true);

Create buttons dynamically from code behind in ASP.NET

I'm quite new to ASP.NET and I need your help.
I'm programming on an application which should help to fix frequent issues. Users can click the displayed cases if it describes their problem. The application searches for more cases or displays a possible solution.
Now what I need for this is some code which creates the buttons dynamically. I googled some ideas and created some code, however I was not able to get it to work.
It works to create the first selection of buttons with the Default_Load method. Also the OnClick event (ButtonClick_System) works fine which means I get the next selection.
From here it starts messing around. The dynamic buttons created in ButtonClick_System don't have a working OnClick action.
Instead of proceeding with ButtonClick_Question (because of btn_system.Command += ButtonClick_Question; in ButtonClick_System) it seems like it just loads the homepage (maybe something wrong with Page_Load?).
The application should do ButtonClick_Question until no more datasets available in database.
I got the following code:
using System;
using System.Configuration;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Data;
using Oracle.DataAccess.Client;
namespace Application
{
public partial class _default : System.Web.UI.Page
{
// Variables
private string app_name = "Application";
// ----- Page_Load ----- //
protected void Page_Load(object sender, EventArgs e)
{
Default_Load();
Session["Application"] = app_name;
}
// ----- Methods ----- //
// Load homepage
public void Default_Load()
{
pnl_default.Visible = true;
pnl_content.Visible = false;
HtmlGenericControl html_default = new HtmlGenericControl();
html_default.TagName = "div";
string cmdString = "(...)";
DataTable dtSystems = OraQueryData(cmdString);
foreach (DataRow dtRow in dtSystems.Rows)
{
int system_id = Convert.ToInt32(dtRow["SYSTEM_ID"]);
string system_name = Convert.ToString(dtRow["SYSTEM_NAME"]);
var btn_system = new Button
{
ID = "btn_" + system_name,
Text = system_name,
CssClass = "sys_buttons"
};
btn_system.Command += ButtonClick_System;
btn_system.CommandArgument = Convert.ToString(system_id);
html_default.Controls.Add(btn_system);
}
plh_default.Controls.Clear();
plh_default.Controls.Add(html_default);
}
// Button OnClick Events
protected void ButtonClick_System(object sender, CommandEventArgs e)
{
pnl_default.Visible = false;
pnl_content.Visible = true;
HtmlGenericControl html_questions = new HtmlGenericControl();
html_questions.TagName = "div";
int system_id = Convert.ToInt32(e.CommandArgument);
string cmdString = "(...)";
DataTable dtQuestions = OraQueryData(cmdString);
foreach (DataRow dtRow in dtQuestions.Rows)
{
string question_id = Convert.ToString(dtRow["FRAGE_ID"]);
string question_text = Convert.ToString(dtRow["FRAGE_TEXT"]);
var btn_system = new Button
{
ID = "btn_question" + question_id,
Text = question_text,
CssClass = "quest_buttons"
};
btn_system.Command += ButtonClick_Question;
btn_system.CommandArgument = Convert.ToString(system_id);
html_questions.Controls.Add(btn_system);
}
plh_content.Controls.Clear();
plh_content.Controls.Add(html_questions);
}
protected void ButtonClick_Question(object sender, CommandEventArgs e)
{
pnl_default.Visible = false;
pnl_content.Visible = true;
HtmlGenericControl html_ChildQuestions = new HtmlGenericControl();
html_ChildQuestions.TagName = "div";
int parent_id = Convert.ToInt32(e.CommandArgument);
string cmdString = "(...)";
DataTable dtChildQuestions = OraQueryData(cmdString);
foreach (DataRow dtRow in dtChildQuestions.Rows)
{
string question_id = Convert.ToString(dtRow["FRAGE_ID"]);
string question_text = Convert.ToString(dtRow["FRAGE_TEXT"]);
var btn_system = new Button
{
ID = "btn_question" + question_id,
Text = question_text,
CssClass = "quest_buttons"
};
btn_system.Command += ButtonClick_Question;
btn_system.CommandArgument = question_id;
html_ChildQuestions.Controls.Add(btn_system);
}
plh_content.Controls.Clear();
plh_content.Controls.Add(html_ChildQuestions);
}
// ----- Oracle Data Query Methods ----- //
// Create and execute query on database
public static DataTable OraQueryData(string cmdString)
{
string conString = ConfigurationManager.AppSettings["Connection"];
OracleConnection oraCon = new OracleConnection(conString);
OracleCommand oraCmd = new OracleCommand(cmdString, oraCon);
OracleDataAdapter oraDtAd = new OracleDataAdapter(oraCmd.CommandText, oraCon);
DataTable dt = new DataTable();
oraCon.Open();
oraDtAd.Fill(dt);
oraCon.Close();
return dt;
}
}
}
If I've understood the issue correctly I think you're using the wrong controls for the wrong usages.
What I'd suggest you need to do is bind the collection of FAQ records to a repeater or some other data set display control. You can then have an event on the repeater which can handle which record ID has been clicked, post back with that value and refresh the collection of data from that (maybe in another repeater). Don't dynamically create buttons and bind events to them otherwise you will end up in a mess.
Hope this helps.

C# asp.net alt tag issue

Hi all im new to the site and have a question to do with c# in asp.net. i have made a website using HTML5 markup and CSS in asp.net with c# for the code behind. The issue im having is i made a index.aspx page with c# code behind to show all my products in a panel which are retrieved directly from the image folder using the Fillpage method. The problem i have is im not sure how to add alt tags to the images as i don't actually see the images until i run my site in the browser. I tested my site for accessibility and it showed the missing alt tag error. Can anyone give me some advice on how to add the alt tags to the images please?
Thank you.
index.aspx.cs
using System;
using System.Collections.Generic;
using System.Web.UI.WebControls;
public partial class Index : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Fillpage();
}
private void Fillpage()
{
//Retrieve list of all products in the database
ProductModel productModel = new ProductModel();
List<Product> products = productModel.GetAllProducts();
//check products exist in the database
if (products !=null)
{
//create a new panel with an imagebutton and 2 labels for each product
foreach (Product product in products)
{
Panel productPanel = new Panel();
ImageButton imageButton = new ImageButton();
Label lblName = new Label();
Label lblPrice = new Label();
//Set childControls properties
imageButton.ImageUrl = "~/Images/Products/" + product.Image;
imageButton.CssClass = "productImage";
imageButton.PostBackUrl = "~/pages/Product.aspx?id=" + product.ID;
lblName.Text = product.Name;
lblName.CssClass = "productName";
lblPrice.Text = "£" + product.Price;
lblPrice.CssClass = "productPrice";
//Add childControls to the panel
productPanel.Controls.Add(imageButton);
productPanel.Controls.Add(new Literal{Text = "<br />"});
productPanel.Controls.Add(lblName);
productPanel.Controls.Add(new Literal{Text = "<br />"});
productPanel.Controls.Add(lblPrice);
//Add dynamic paneld to static parent panel
pnlProducts.Controls.Add(productPanel);
}
}
else
{
//no products found
pnlProducts.Controls.Add(new Literal {Text = "No Products found!"});
}
}
}
product.aspx.cs
using System;
using System.Linq;
using Microsoft.AspNet.Identity;
public partial class Pages_Product : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
FillPage();
}
protected void btnAdd_Click(object sender, EventArgs e)
{
if (!string.IsNullOrWhiteSpace(Request.QueryString["id"]))
{
string clientId = Context.User.Identity.GetUserId();
if (clientId != null)
{
int id = Convert.ToInt32(Request.QueryString["id"]);
int amount = Convert.ToInt32(ddlAmount.SelectedValue);
Cart cart = new Cart
{
Amount = amount,
ClientID = clientId,
DatePurchased = DateTime.Now,
IsInCart = true,
ProductID = id
};
CartModel model = new CartModel();
lblResult.Text = model.InsertCart(cart);
}
else
{
lblResult.Text = " Please log in to order products ";
}
}
}
private void FillPage()
{
//Get selected product data
if (!string.IsNullOrWhiteSpace(Request.QueryString["id"]))
{
int id = Convert.ToInt32(Request.QueryString["id"]);
ProductModel model = new ProductModel();
Product product = model.GetProduct(id);
//Fill page with data
lblTitle.Text = product.Name;
lblDescription.Text = product.Description;
lblPrice.Text = "Price per unit:<br/>£ " + product.Price;
imgProduct.ImageUrl = "~/Images/Products/" + product.Image;
lblItemNr.Text = product.ID.ToString();
//Fill amount list with numbers 1-20
int[] amount = Enumerable.Range(1, 20).ToArray();
ddlAmount.DataSource = amount;
ddlAmount.AppendDataBoundItems = true;
ddlAmount.DataBind();
}
}
}
Use imageButton.AlternateText property.

How can I let page fully loaded and show the searching result then go to next loop?

I want to write an windows form application who can do auto data filling in an textbox on the web page and get the corresponding data show on the page one by one. I met a problem that my loop goes too fast and I cannot see the result showing on the page. How can I let the page fully loaded and then go the next loop?
My designer has a textbox which is used to input url, webBrowser to browse the web page, the button is used to lunch the page.
My code are as below. I use "http://finance.yahoo.com/" as testing page. Testing data is in excel format. the data is a row, like " msft, bac, f, aapl".
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Net;
using System.IO;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string url = textBox1.Text;
var request = (HttpWebRequest)WebRequest.Create(url);
var response = (HttpWebResponse)request.GetResponse();
Stream stream = response.GetResponseStream();
StreamReader sr = new StreamReader(stream);
string content = sr.ReadToEnd();
webBrowser1.DocumentText = content;
}
public void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
HtmlElement tbUserid = webBrowser1.Document.GetElementById("mnp-search_box");
//HtmlElement tbPasswd = webBrowser1.Document.GetElementById("pwdInput");
HtmlElement btnSubmit = webBrowser1.Document.GetElementById("yucs-sprop_button");
webBrowser1.DocumentCompleted += webBrowser1_DocumentCompleted;
if (tbUserid == null || btnSubmit == null)
{
return;
}
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source='d:\\testing file\\list.xls';Extended Properties= \"Excel 8.0;HDR=Yes;IMEX=1\";");
OleDbDataAdapter da = new OleDbDataAdapter("select * from [List$]", con);
DataTable dt = new DataTable();
da.Fill(dt);
/* int i = 0;
do
{
string str = dt.Rows[i][0].ToString();
tbUserid.SetAttribute("value", str);
//System.Threading.Thread.Sleep(10000);
btnSubmit.InvokeMember("click");
evt.WaitOne();
i++;
}
while (i < dt.Rows.Count);
*/
for (int i = 0; i < dt.Rows.Count; i++)
{
string str = dt.Rows[i][0].ToString();
tbUserid.SetAttribute("value", str);
btnSubmit.InvokeMember("click");
Application.DoEvents();
//System.Threading.Thread.Sleep(100);
}
// ((WebBrowser)sender).Dispose();
}
}
}
Ok, so, let's suppose your target page is http://thisis.my/addres.html and when the page has been used to insert a row it redirects to http://thisis.my/secondaddres.html.
First, let's create a List to hold all the data from the table and two strings to hold the concrete addresses:
List<string> rows = new List<string>();
static string fillAddress = "http://thisis.my/addres.html";
static string sentAddress = "http://thisis.my/secondaddres.html";
Second, when the button is pressed load the data in the list and do your first navigation:
private void button1_Click(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source='d:\\testing file\\list.xls';Extended Properties= \"Excel 8.0;HDR=Yes;IMEX=1\";");
OleDbDataAdapter da = new OleDbDataAdapter("select * from [List$]", con);
DataTable dt = new DataTable();
da.Fill(dt);
for (int i = 0; i < dt.Rows.Count; i++)
{
string str = dt.Rows[i][0].ToString();
rows.Add(str);
}
webBrowser1.NavigateTo(fillAddress);
}
Ensure that your DocumentCompleted event is hooked thorugh designer or code.
And finally when a document has been fully loaded the do this sequence:
If page == fillAddress
If rows is not empty
Extract row
Fill row
Submit
else
We have finished
else
Navigate to fillAddress
-
public async void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
if(e.Url.ToString() == fillAddress)
{
if(rows.Count > 0)
{
HtmlElement tbUserid = webBrowser1.Document.GetElementById("mnp-search_box");
HtmlElement btnSubmit = webBrowser1.Document.GetElementById("yucs-sprop_button");
if (tbUserid == null || btnSubmit == null)
return;
string str = rows[0];
rows.RemoveAt(0);
tbUserid.SetAttribute("value", str);
btnSubmit.InvokeMember("click");
}
else
return;
}
else if(e.Url.ToString() == sentAddress)
webBrowser1.NavigateTo(fillAddress);
}
I have done tons of assumptions but you will get the general idea: get a list of data, navigate, when the page to fill is loaded fill the row and send the data, when the confirmation is done navigate again to the fill form and repeat until no data is left.

C# Form not included in the project

I am having this strange error/conflict. I have two forms in my application. Both have same namespaces, and when I try to create an object of the next form it doesn't shows up. This is my code in Form1
Form2 form2 = new Form2();
form2.Show();
this.Hide();
And when I add another form in the project (like form3.cs) it shows up. Why is this "form2" missing? Although it is available in the project.
Form 1 code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Data.SqlServerCe;
using UHF_Demo;
namespace UHF_Demo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void submit_Click(object sender, EventArgs e)
{
{
string query = "Select * from login_info where username = '" + username_tb.Text + "' and password = '" + password_tb.Text + "'";
SqlCeConnection conn = new SqlCeConnection();
conn.ConnectionString = #"Data Source =\Program Files\valcan\employeedb.sdf";
SqlCeCommand cmd = new SqlCeCommand(query, conn);
conn.Open();
SqlCeDataReader dr = cmd.ExecuteReader();
int counter = 0;
while (dr.Read())
{
counter = counter + 1;
}
if (counter > 0)
{
Form2 form2 = new Form2();
form2.Show();
this.Hide();
}
else
{
MessageBox.Show("Invalid Login name or Password. Please try again ....");
}
conn.Close();
dr.Close();
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'locationds.login_info' table. You can move, or remove it, as needed.
this.login_infoTableAdapter.Fill(this.locationds.login_info);
}
}
}
}}
Form2 code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Threading;
using System.Globalization;
using System.IO;
namespace UHF_Demo
{
public partial class MR6651_DEMO : Form
{
public bool BeingId = false;
byte[,] TagBuf = new byte[100, 14];
byte TagCnt = 0;
ComPort Port0 = new ComPort();
private CultureInfo culinfo = CultureInfo.CurrentCulture;
public MR6651_DEMO()
{
InitializeComponent();
double CostomiseFQ = 900.000;
for (int i = 0; i < 60; i++)
{
comboBox1.Items.Add(CostomiseFQ.ToString("#0.000")+"M");
comboBox2.Items.Add(CostomiseFQ.ToString("#0.000") + "M");
CostomiseFQ +=0.5;
}
MEMBANK.SelectedIndex = 1;
WORDPTR.SelectedIndex = 0;
WORDCNT.SelectedIndex = 0;
cmbFreqType.SelectedIndex = 2;
VALUE.Text = "";
//tabPage3.Parent = null;
if (culinfo.ToString() == "zh-CN")
{
this.Text = "UHF¶ÁдÑÝʾ";
TabPage page1 = tabControl1.TabPages[0];
page1.Text = "»¶Ó­";
TabPage page2 = tabControl1.TabPages[1];
page2.Text = "EPC²âÊÔ";
//TabPage page3 = tabControl1.TabPages[2];
//page3.Text = "6B²âÊÔ";
label5.Text = "¹¦ÂÊ";
label8.Text = "ƵÂÊ";
labStatusBar.Text = "×¼±¸¾ÍÐ÷";
btnQueryPower.Text = "²éѯ";
btnSetPower.Text = "ÉèÖÃ";
EXIT.Text = "Í˳ö";
chkAutoClr.Text = "¹ýÂËÖظ´±êÇ©";
ID.Text = "ʶ±ð";
btnEPClist.Text = "Áбí";
button1.Text = "EPC¿é²Ù×÷";
CLEAR.Text = "Çå¿Õ";
label2.Text = "×ÖµØÖ·";
label3.Text = "×Ö³¤¶È";
label4.Text = "Êý¾Ý";
READ.Text = "¶ÁÈ¡";
WRITE.Text = "дÈë";
INIT.Text = "³õʼ»¯";
label10.Text = "×Ö½ÚµØÖ·";
label7.Text = "×Ö½Ú³¤¶È";
label9.Text = "Êý¾Ý";
btn6BID.Text = "ʶ±ð";
btn6BRead.Text = "¶ÁÈ¡";
btn6BWrite.Text = "дÈë";
btn6BLock.Text = "Ëø¶¨";
chkClear6B.Text = "¹ýÂËÖظ´±êÇ©";
btn6BClear.Text = "Çå¿Õ";
btnSaveFile.Text = "±£´æÎļþ";
label1.Text = "Êý¾Ý¿é";
cmbFreqType.Items.Clear();
cmbFreqType.Items.Add("Öйú");
cmbFreqType.Items.Add("±±ÃÀ");
cmbFreqType.Items.Add("Å·ÖÞ");
cmbFreqType.Items.Add("×Ô¶¨Òå");
cmbFreqType.SelectedIndex = 2;
listViewEPC.Columns[0].Text = "EPCÂë";
listViewEPC.Columns[1].Text = "񅧏";
label11.Text = "ÆðʼƵµã";
label12.Text = "ÖÕֹƵµã";
btn_locktid.Text = "ËøTID";
btn_seelocktid.Text = "²é¿´TIDËø";
}
}
private void EPC_DEMO_Load(object sender, EventArgs e)
{
if (Port0.Open() == 0)
{
if (culinfo.ToString() == "zh-CN")
{
labStatusBar.Text = "ͨѶ¶Ë¿Ú´ò¿ª³É¹¦!";
}
else
{
labStatusBar.Text = "Start conmunicate commport success!";
}
//aStatus = Port0.SetRf(10, 2);
Thread.Sleep(500);
btnQueryPower_Click(sender, e);
Sound.PlayWAV(#"\Application Data\Rfid\wav\shutter.wav");
for (int i = 0; i < 223; i++)
ADDR6B.Items.Add(i.ToString());
ADDR6B.SelectedIndex = 0;
ByteCnt6B.SelectedIndex = 0;
}
}
You have no Form2 class. You've got a MR6651_DEMO class. Try creating an instance of that instead. Your compiler should be telling you exactly what's wrong.
The name of a file doesn't have to have anything to do with the class contained within - that they often match is a matter of hygiene and sanity. =)
In your Form 2 Code there is no Class Definition for a Class named Form2. I guess thats the cause why it can't be found.

Categories

Resources