|
Hi there,
I had download a C# code for connecting a mobile with a computer using the bluetooth,
but I had for the first time see these :
using System.Linq;
using C4F.DevKit.Bluetooth.DeviceAndServiceDiscovery;
using system.core;
using system.data.datasetextensions;
I know I have to download the appropriate library, I have searched the net but I could not successfully find'm
if you know where can I download them from , please send me back as soon as possible
Thank you , your help is valuable .
There is always something to learn
There is always something to learn
|
|
|
|
|
Try downloading Visual C# 2008 Express. The C4F is the coding for fun stuff that MS has released, and the other items are part of .NET 3.5.
|
|
|
|
|
thanks for replaying
I am using .Net Visual Studio 2005 , and I was wondering if there is some thing to be downloaded can enable me to run the program ?
In other word what can I do to run the program using .Net 2005
?
There is always something to learn
|
|
|
|
|
Rewrite it. If it's using things like Linq then it's either using the Beta Orcas stuff or it's a .NET 3.5 application. Alternatively, you could upgrade to VS 2008 (the Express editions are free and available to use now).
|
|
|
|
|
hi friends,Im using validation summary,and i set ShowMessageBox=true.it Shows msgbox,but i cant focus to first control what it lists me...i would like set focus..how can i do it my friend?
Hi,Im Razana
|
|
|
|
|
this.ActiveControl = myControl;
Where myControl is any control such as a button, textBox etc.
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
// ASCX file
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class PresentationLayer_Controls_ManagePaymentDetailsControl : System.Web.UI.UserControl
{
Payment ObjXMLData = new Payment();
public static int editstatus =0;
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (!IsPostBack)
{
Session["update"] = Server.UrlEncode(System.DateTime.Now.ToString()); // to avoid page refresh problem
//string opno = "0p005";
//txtOpno.Text = opno;
txtDate.Text = ObjXMLData.ConvertDate(DateTime.Today.Date.ToString().Substring(0, 10));
txtDate.Text = txtDate.Text.Substring(3, 2) + "/" + txtDate.Text.Substring(0, 2) + "/" + txtDate.Text.Substring(6, 4);
try
{
//GetData(opno, Server.MapPath("Amount.xml").ToString());
BindGrid();
}
catch (Exception ex)
{
lbl_Error.Text = ex.Message;
}
}
}
catch (Exception ex)
{
string s = ex.Message;
}
}
public void GetData(string opno, string path,int estatus)
{
try
{
DataSet ds;
DataTable dt = ObjXMLData.GetByOpNo(opno, path);
if (dt.Columns.Count > 0)
{
if (estatus == 1)
{
txtOpno.Text = dt.Rows[0].Table.Rows[0]["OpNo"].ToString();
txtName.Text = dt.Rows[0].Table.Rows[0]["Name"].ToString();
txtPaidAmount.Text = dt.Rows[0].Table.Rows[0]["PaidAmount"].ToString();
txtTotalAmount.Text = dt.Rows[0].Table.Rows[0]["TotalAmount"].ToString();
txtBalanceAmount.Text = dt.Rows[0].Table.Rows[0]["BalanceAmount"].ToString();
}
else
{
txtOpno.Text = dt.Rows[0].Table.Rows[0]["OpNo"].ToString();
txtName.Text = dt.Rows[0].Table.Rows[0]["Name"].ToString();
//txtPaidAmount.Text = dt.Rows[0].Table.Rows[0]["PaidAmount"].ToString();
//txtTotalAmount.Text = dt.Rows[0].Table.Rows[0]["TotalAmount"].ToString();
txtBalanceAmount.Text = dt.Rows[0].Table.Rows[0]["BalanceAmount"].ToString();
}
}
else
{
string msg = "<script type='text/javascript'>alert('No Records Found');</script> ";
Page.ClientScript.RegisterStartupScript(this.GetType(),"msg",msg);
}
}
catch (Exception ex)
{
string s = ex.Message;
}
}
public void BindGrid()
{
try
{
DataTable dt = null;
dt = ObjXMLData.GetAll(Server.MapPath("Amount.xml").ToString());
if (dt.Rows.Count != 0)
{
DataGrid1.DataSource = dt;
DataGrid1.DataBind();
lblcount.Text = "Total No of Records:" + dt.Rows.Count;
int pindex = DataGrid1.CurrentPageIndex + 1;
lblpageindex.Text = "Page" + pindex + " of " + DataGrid1.PageCount.ToString();
}
else
PageList.Attributes.Add("style", "display:none");
}
catch (Exception ex)
{
lbl_Error.Text = ex.Message;
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
try
{
DataTable dt = ObjXMLData.GetByOpNo(txtOpno.Text.Trim().ToUpper(), Server.MapPath("Amount.xml").ToString());
Double Result;
string totalamount;
if (Session["update"].ToString() == ViewState["update"].ToString()) // to avoid page refresh problem
{
if (CheckBox1.Checked == false)
totalamount = dt.Rows[0].Table.Rows[0]["TotalAmount"].ToString();
else
totalamount = txtTotalAmount.Text;
if (Convert.ToDouble(totalamount) >= Convert.ToDouble(txtPaidAmount.Text))
{
if (CheckBox1.Checked == true)
{
Result = ObjXMLData.Update(txtOpno.Text.ToUpper(), DateTime.Now.ToString(), txtName.Text,
Convert.ToDouble(txtTotalAmount.Text) + Convert.ToDouble(txtBalanceAmount.Text), (Convert.ToDouble(dt.Rows[0].Table.Rows[0]["PaidAmount"].ToString()) + Convert.ToDouble(txtPaidAmount.Text)),
Convert.ToDouble(Convert.ToDouble(dt.Rows[0].Table.Rows[0]["TotalAmount"].ToString()) - (Convert.ToDouble(dt.Rows[0].Table.Rows[0]["PaidAmount"].ToString()) + Convert.ToDouble(txtPaidAmount.Text))), Server.MapPath("").ToString());
}
else
{
Result = ObjXMLData.Update(txtOpno.Text.ToUpper(), DateTime.Now.ToString(), txtName.Text,
Convert.ToDouble(dt.Rows[0].Table.Rows[0]["TotalAmount"].ToString()), (Convert.ToDouble(dt.Rows[0].Table.Rows[0]["PaidAmount"].ToString()) + Convert.ToDouble(txtPaidAmount.Text)),
Convert.ToDouble(Convert.ToDouble(dt.Rows[0].Table.Rows[0]["TotalAmount"].ToString()) - (Convert.ToDouble(dt.Rows[0].Table.Rows[0]["PaidAmount"].ToString()) + Convert.ToDouble(txtPaidAmount.Text))), Server.MapPath("").ToString());
}
if (Result >= 1)
{
lbl_Error.Text = " Trasaction Status : Success ";
BindGrid();
}
else
{
lbl_Error.Text = " Transaction Status : Fail ";
}
}
else
{
lbl_Error.Text = " Transaction Status : Fail ";
}
}
}
catch (Exception ex)
{
string s = ex.Message;
}
}
protected void Page_PreRender(Object s, System.EventArgs e)
{
ViewState["update"] = Session["update"];
}
protected void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e)
{
if (e.CommandName == "Editing")
{
editstatus = 1;
CheckBox1.Checked = true;
total.Attributes.Add("style", "Display:block");
GetData(e.CommandArgument.ToString(), Server.MapPath("Amount.xml").ToString(), editstatus);
}
}
protected void btnReset_Click(object sender, EventArgs e)
{
editstatus = 0;
txtBalanceAmount.Text = "";
txtOpno.Text = "";
txtPaidAmount.Text = "";
txtTotalAmount.Text = "";
txtName.Text = "";
}
protected void txtOpno_TextChanged(object sender, EventArgs e)
{
if (txtOpno.Text != "")
{
editstatus = 0;
GetData(txtOpno.Text.Trim().ToUpper(), Server.MapPath("Amount.xml").ToString(), editstatus);
}
}
protected void txtTotalAmount_TextChanged(object sender, EventArgs e)
{
DataTable dt = ObjXMLData.GetByOpNo(txtOpno.Text.Trim().ToUpper(), Server.MapPath("Amount.xml").ToString());
if (editstatus == 0)
{
if (txtTotalAmount.Text.Trim() != "" && txtPaidAmount.Text.Trim() != "" && CheckBox1.Checked == true)
txtBalanceAmount.Text = Convert.ToString((Convert.ToDouble(txtTotalAmount.Text) + Convert.ToDouble(dt.Rows[0].Table.Rows[0]["BalanceAmount"].ToString())) - Convert.ToDouble(txtPaidAmount.Text));
else if (txtPaidAmount.Text.Trim() != "")
txtBalanceAmount.Text = Convert.ToString(Convert.ToDouble(dt.Rows[0].Table.Rows[0]["BalanceAmount"].ToString()) - Convert.ToDouble(txtPaidAmount.Text));
else
txtBalanceAmount.Text = dt.Rows[0].Table.Rows[0]["BalanceAmount"].ToString();
}
else
{
if (txtTotalAmount.Text.Trim() != "" && txtPaidAmount.Text.Trim() != "")
txtBalanceAmount.Text = Convert.ToString(Convert.ToDouble(txtTotalAmount.Text) - Convert.ToDouble(txtPaidAmount.Text));
else
txtBalanceAmount.Text = dt.Rows[0].Table.Rows[0]["BalanceAmount"].ToString();
}
}
protected void txtPaidAmount_TextChanged(object sender, EventArgs e)
{
DataTable dt = ObjXMLData.GetByOpNo(txtOpno.Text.Trim().ToUpper(), Server.MapPath("Amount.xml").ToString());
if (editstatus == 0 )
{
if (txtTotalAmount.Text.Trim() != "" && txtPaidAmount.Text.Trim() != "" && CheckBox1.Checked == true)
txtBalanceAmount.Text = Convert.ToString((Convert.ToDouble(txtTotalAmount.Text) + Convert.ToDouble(dt.Rows[0].Table.Rows[0]["BalanceAmount"].ToString())) - Convert.ToDouble(txtPaidAmount.Text));
else if (txtPaidAmount.Text.Trim() != "")
txtBalanceAmount.Text = Convert.ToString(Convert.ToDouble(dt.Rows[0].Table.Rows[0]["BalanceAmount"].ToString()) - Convert.ToDouble(txtPaidAmount.Text));
else
txtBalanceAmount.Text = dt.Rows[0].Table.Rows[0]["BalanceAmount"].ToString();
}
else
{
if (txtTotalAmount.Text.Trim() != "" && txtPaidAmount.Text.Trim() != "")
txtBalanceAmount.Text = Convert.ToString(Convert.ToDouble(txtTotalAmount.Text) - Convert.ToDouble(txtPaidAmount.Text));
else
txtBalanceAmount.Text = dt.Rows[0].Table.Rows[0]["BalanceAmount"].ToString();
}
}
protected void DataGrid1_PageIndexChanged(object source, DataGridPageChangedEventArgs e)
{
try
{
DataGrid1.CurrentPageIndex = e.NewPageIndex;
int pindex = DataGrid1.CurrentPageIndex + 1;
lblpageindex.Text = "Page" + pindex + " of " + DataGrid1.PageCount.ToString();
BindGrid();
}
catch (Exception ex)
{
string s = ex.Message;
}
}
protected void ddlpagecount_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
DataTable dt = null;
dt = ObjXMLData.GetAll(Server.MapPath("Amount.xml").ToString());
DataGrid1.CurrentPageIndex = 0;
if (ddlpagecount.SelectedValue == "All")
{
DataGrid1.PageSize = dt.Rows.Count;
}
else
{
DataGrid1.PageSize = Convert.ToInt32(ddlpagecount.SelectedValue);
}
BindGrid();
int pindex = DataGrid1.CurrentPageIndex + 1;
lblpageindex.Text = "Page" + pindex + " of " + DataGrid1.PageCount.ToString();
}
catch (Exception ex)
{
string s = ex.Message;
}
}
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
if(CheckBox1.Checked == true)
total.Attributes.Add("style","Display:block");
else
total.Attributes.Add("style", "Display:none");
}
}
srinivas
|
|
|
|
|
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
/// <summary>
/// Summary description for Payment
/// </summary>
public class Payment
{
public Payment()
{
//
// TODO: Add constructor logic here
//
}
public DataTable GetAll(string Path)
{
DataTable dt = new DataTable();
DataSet ds = new DataSet();
ds.ReadXml(Path + "");
DataTable dt_ret = ds.Tables[0];
return dt_ret;
}
public DataTable GetByOpNo(string OpNo, string Path)
{
DataSet ds = new DataSet();
DataTable dt = new DataTable();
ds.ReadXml(Path);
DataTable dt_ret = ds.Tables[0];
int b = 0;
//INSTANT C# NOTE: The ending condition of VB 'For' loops is tested only on entry to the loop. Instant C# has created a temporary variable in order to use the initial value of dt_ret.Rows.Count for every iteration:
int tempFor1 = dt_ret.Rows.Count;
for (b = 0; b < tempFor1; b++)
{
if (OpNo.ToString().ToUpper().ToString() == dt_ret.Rows[b]["OpNo"].ToString().ToUpper().ToString())
{
DataRow dr = null;
dt.Columns.Add("ID");
dt.Columns.Add("OpNo");
dt.Columns.Add("Date");
dt.Columns.Add("Name");
dt.Columns.Add("TotalAmount");
dt.Columns.Add("PaidAmount");
dt.Columns.Add("BalanceAmount");
dr = dt.NewRow();
dr["ID"] = dt_ret.Rows[b]["ID"];
dr["OpNo"] = dt_ret.Rows[b]["OpNo"].ToString().ToUpper();
dr["Date"] = dt_ret.Rows[b]["Date"];
dr["Name"] = dt_ret.Rows[b]["Name"];
dr["TotalAmount"] = dt_ret.Rows[b]["TotalAmount"];
dr["PaidAmount"] = dt_ret.Rows[b]["PaidAmount"];
dr["BalanceAmount"] = dt_ret.Rows[b]["BalanceAmount"];
dt.Rows.Add(dr);
return dt;
}
}
return dt;
}
public long Update(string OpNo, string Date, string Name, Double TotalAmount,
Double PaidAmount, Double BalanceAmount, string Path)
{
try
{
DataSet ds = new DataSet();
ds.ReadXml(Path + "/Amount.xml");
DataRow dr = null;
dr = ds.Tables[0].NewRow();
int a = 0;
int b = 0;
//INSTANT C# NOTE: The ending condition of VB 'For' loops is tested only on entry to the loop. Instant C# has created a temporary variable in order to use the initial value of ds.Tables(0).Rows.Count for every iteration:
int tempFor1 = ds.Tables[0].Rows.Count;
string s = "";
for (b = 0; b < tempFor1; b++)
{
if (OpNo.ToString().ToUpper() == ds.Tables[0].Rows[b]["OpNo"].ToString().ToUpper())
{
s = "abc"; a = b;
}
}
//for (b = 0; b < tempFor1; b++)
//{
if (s.ToString() == "abc")
{
if (OpNo.ToString().ToUpper().ToString() == ds.Tables[0].Rows[a]["OpNo"].ToString().ToUpper().ToString())
{
ds.Tables[0].Rows[a]["OpNo"] = OpNo.ToUpper();
ds.Tables[0].Rows[a]["Date"] = Date;
ds.Tables[0].Rows[a]["Name"] = Name;
ds.Tables[0].Rows[a]["TotalAmount"] = TotalAmount;
ds.Tables[0].Rows[a]["PaidAmount"] = PaidAmount;
ds.Tables[0].Rows[a]["BalanceAmount"] = BalanceAmount;
ds.WriteXml(Path + "/Amount.xml");
}
}
else
{
try
{
dr = ds.Tables[0].NewRow();
if (ds.Tables[0].Rows.Count > 0)
{
dr["ID"] = System.Convert.ToInt64(ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["id"]) + 1;
}
else
{
dr["ID"] = 1;
}
dr["OpNo"] = OpNo.ToUpper();
dr["Date"] = Date;
dr["Name"] = Name;
dr["TotalAmount"] = TotalAmount;
dr["PaidAmount"] = PaidAmount;
dr["BalanceAmount"] = BalanceAmount;
ds.Tables[0].Rows.Add(dr);
ds.WriteXml(Path + "/Amount.xml");
return 1;
}
catch (Exception ex)
{
return 0;
}
}
//}
return 1;
}
catch (Exception ex)
{
return 0;
}
}
//*****************************************************************************
//*************** Converting mm/dd/yyyy
//*****************************************************************************
public string ConvertDate(string s)
{
string p = "";
string[] dttime = s.ToString().Split('/');
for (int i = 0; i < dttime.Length; i++)
{
if (i == 0)
{
if (int.Parse(dttime[i].ToString()) < 10)
p = "0" + int.Parse(dttime[i].ToString());
else
p = dttime[i].ToString();
}
else if (i == 1)
{
if (int.Parse(dttime[i].ToString()) < 10)
p += "/" + "0" + int.Parse(dttime[i].ToString());
else
p += "/" + int.Parse(dttime[i].ToString());
}
else if (i == 2)
p += "/" + dttime[i].ToString();
}
return p;
}
}
srinivas
|
|
|
|
|
And your question is what? Other than your inability to change the default name of any of the stuff you've dropped on your form, I can't actually see what you're trying to do unless you've mistaken CodeProject for SourceSafe.
|
|
|
|
|
Pete O'Hanlon wrote: unless you've mistaken CodeProject for SourceSafe
|
|
|
|
|
hi All,
i want to scroll two listviews to be scrolled simeltaniously.
so which event handler of listview shud be used?
& how to code for this stuff........
so plz help me for this..
thanx in advance......
Best Regards,
Dnyan
|
|
|
|
|
The scroll event seems the obvious choice, when one scrolls, check if the other is out of sync and if so, scroll it. Don't just scroll it, your big issue will be making sure the two events don't keep just scrolling each others windows, until the stack overflows.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi Christian Graus,
i think u r right?
but now consider there is same size always......
so both shud syncro simeltaiously........
plz give me some solution
thanx
|
|
|
|
|
HI ,
I am developing a small application in which C# reads a file make changes to it and saves it.
The txt files contains dome configuration values say
TimeOut=30<br />
ID=abcd<br />
Scope=Allowed<br />
.<br />
.<br />
.<br />
1.In my screen i also want to show these values, so what is the method to fetch individual values
2.When i make any change to the value i want it to be saved in that particular line itself.
Thanks in Advance.
Deepak Surana
|
|
|
|
|
Why are you using an ini file and not XML ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I'm not saying that INI files are the be all and end all of config files, but they are a *lot* easier for novice users to edit, compared to XML files.
Cheers,
Vikram.
"real dictators don't loose[sic] elections." - Diego Moita.
|
|
|
|
|
deepaks3 wrote: 1.In my screen i also want to show these values, so what is the method to fetch individual values
You can read the values into a dictionary like this:
Dictionary<string, string> values = new Dictionary<string, string>();
foreach (string line in File.ReadAllLines(fileName)) {
string[] data = line.Split('=');
if (data.Length == 2) values.Add(data[0], data[1]);
}
To read a value from the dictionary:
string id = values["ID"];
deepaks3 wrote: 2.When i make any change to the value i want it to be saved in that particular line itself.
Files are not line based, so you can't change a single line in a file. It's possible to update the file from that line and forward, but it's complicated. Just rewrite the entire file.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi to all,
I am using .Net framework 1.1 and want to download files from FTP using C#. Anybody please help me to how to do this.
Pravin
|
|
|
|
|
Use WebClient class and DownlodData method in that. Before you need to authenticate the server. There are tons of samples available online.
|
|
|
|
|
is there any way in Listview to set a column property like frozen property in Datagridview ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
No, there isn't.
You'd have to write your own implementation of the ListView control to expose the properties required and provide all the drawing code to do this.
Or, you might want to try and find a 3rd party library that gives you such functionality. I don't know of any that do this.
|
|
|
|
|
hi there,
i want to know that why | and & exists if they seems to be useless infront of || and &&
please tell the use of | and &
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
| and & perform a bitwise operation, while || and && perform logical operations.
Also, the evaluation of || and && expressions is aborted once the result is certain, while | and & takes every operand into consideration.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
| and & are bit-wise operation while || and && are logic operation.
Was it you or somebody else who insisted on using all | and & instead of || and && for logic operations??
|
|
|
|
|
yeah, i remebered, this thing is still confusing
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|