|
in extended columns i press tab and cursor jumjps 2 cells. How could i solve this problem?
|
|
|
|
|
Hi,
I am doing an asynchronous call as below.
Initially in the method EmployeeDetailsUpdate I had:
//ws.EmployeeDetailsUpdate(intEmployeeID, strTitle, dtBirthDate, strNotes);
as you can see below in the code.
Then I comment it out and replaced it with the async call.
The code runs fine. I just thought I get a professional look into this.
So do you think my asynchronous call is correct?
Please have a look at both the methods below.
Thanks
public void EmployeeDetailsUpdate(int intEmployeeID, string strTitle, DateTime dtBirthDate, string strNotes)
{
try
{
EmpService.Employees ws = new EmpService.Employees();
//ws.EmployeeDetailsUpdate(intEmployeeID, strTitle, dtBirthDate, strNotes);
//Asynchronous call...
AsyncCallback acb = new AsyncCallback(HandleCallbackUpdate);
ws.BeginEmployeeDetailsUpdate(intEmployeeID, strTitle, dtBirthDate, strNotes,
acb, ws);
}
catch
{
throw;
}
}
private void HandleCallbackUpdate(IAsyncResult ar)
{
try
{
EmpService.Employees ws;
ws = (EmpService.Employees)ar.AsyncState;
ws.EndEmployeeDetailsUpdate(ar);
}
catch
{
throw;
}
}
|
|
|
|
|
|
I just spotted an issue here.
This asynchronous call is on the business layer where it calls the webservice.
On the client side, when the webservice call has ended, it calls another method to populate a datagrid on the windows form.
So, since it is an async call now, before the end... is called, it sometimes calls the populatioin of the grid. So the grid gets populated before the end... call is called (Therefore incorrect population).
So should I still be using the async call here?
Hope you follow what I mean.
Thanks
|
|
|
|
|
Hi everybody, i'd like to know ('cause I'm on my first experience with c#) if it is possible with xmltextwriter, to write a new node in a specified position.
Thank you
|
|
|
|
|
Not with an XmlTextWriter , no. That is used to merely write out XML forward-only, appending elements, fragments, etc. all moving forward. If you want to open an existing XML document and add an element in a certain position use the XmlDocument to load the XML and use one of the XPath methods like SelectSingleNode to find the node you want, then either prepend or append the node you want to add like so:
class Program
{
static void Main(string[] args)
{
string xml = @"<?xml version=""1.0""?>
<root>
<child id=""one"">
<grandchild id=""a""/>
<grandchild id=""b""/>
</child>
<child id=""two"">
<grandchild id=""c""/>
<grandchild id=""d""/>
</child>
</root>";
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
XmlNode node = doc.DocumentElement.SelectSingleNode(@"child[@id=""two""]");
if (node != null)
{
XmlElement elem = doc.CreateElement("grandchild");
elem.Attributes.Append(doc.CreateAttribute("id"));
elem.Attributes[0].Value = "e";
node.AppendChild(elem);
}
using (XmlTextWriter writer = new XmlTextWriter(Console.Out))
{
writer.Formatting = Formatting.Indented;
doc.WriteTo(writer);
}
}
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thank you so much...in fact I was reading msdn documentation for xmlDataDocument...now I'll go trying...thanks agains
|
|
|
|
|
Be aware that the XmlDataDocument is really designed for a DataSet or similar schema. If you're XML fragment is more complex you should stick with XmlDocument .
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
well, now...i have the following structure of my xml file:
- <engine_data>
<type id="Variables">
<type id="Parameters">
<type id="BreakPoint">
Now a I want to add dynamically new nodes under Variables, Parameters and BreakPoints, and for each subnode I have many properties to store, any suggestion?
|
|
|
|
|
<br />
<Engine_Data><br />
<Type id=""Variables""><br />
</Type><br />
<Type id=""Parameters""><br />
</Type><br />
<Type id=""BreakPoint""><br />
</Type><br />
</Engine_Data><br />
<br />
|
|
|
|
|
You need to change < to < and > to >, or check "Ignore HTML tags in this message" when posting SGML-derivative code like HTML and XML.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Afternoon!
Hello to everyone! My partner and I want to write in a voice conversation program, and we are making use of C#. And now, I can catch the voice from the sound card and store it in the buffer. But now I have a trouble in a big problem. “I can convey a voice file to another. But what should I do when my files pass that can make another client read-out the files and broadcast it.” (That the files are in the buffer.)
Now! In an emergency, mail to u9213120@yuntech.edu.tw
When I have received help from yours truly makes me more skillful.
Thank you for your attention!
|
|
|
|
|
Hi. I tried asking this question in ZedGraph article, but I got no answer.
I have a database with some data that I would like to be represented in graphs.
The database is like this:
exercise | weight | maxweight
squat | 100 | 120
deadlift | 120 | 130
rows | 50 | 20
<- edit: the spaces may not show correctly ->
I would like to represent the values from each exercise in graphs. but i have no idea how to do that. - i'm using the "bar-graph" from ZedGraph.
I would also like the graph to be dynamic, so that if a user inserts a new exercise, then the graph will extend with another graph.
this is what i have currently:
private void OnRenderGraph(System.Drawing.Graphics g, ZedGraph.MasterPane mPane)
{
GraphPane pane = mPane[0];
pane.Title = "Training";
pane.YAxis.Title = "Exercise";
pane.XAxis.Title = "Weight (kg)";
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
SqlDataReader rdr = null;
conn.Open();
SqlCommand cmd = new SqlCommand("SELECT exercise FROM training WHERE userid='"+ Page.Request.Params["userid"] +"'", conn);
rdr = cmd.ExecuteReader();
rdr.Read();
double[] x = { 50, 30, 50 };
BarItem myCurve = pane.AddBar("Weight", x, null, Color.DarkGreen);
myCurve.Bar.Fill = new Fill(Color.DarkGreen, Color.LightGreen, Color.DarkGreen, 90f);
string[] labels = { rdr["exercise"].ToString() };
pane.YAxis.TextLabels = labels;
rdr.Close();
conn.Close();
// Draw the Y tics between the labels instead of at the labels
pane.YAxis.IsTicsBetweenLabels = true;
// Set the YAxis to Text type
pane.YAxis.Type = AxisType.Text;
// Set the bar type to stack, which stacks the bars by automatically accumulating the values
pane.BarType = BarType.Stack;
// Make the bars horizontal by setting the BarBase to "Y"
pane.BarBase = BarBase.Y;
pane.AxisChange(g);
}
I am very new to C# and asp.net.
I know that i should put the rdr.Close() and conn.Close() into an exception with the rest of the sql connection, but i'm still testing.
|
|
|
|
|
Hello,
I am working on a c#.net windows project,i want to schedule some task, i need your help pls help me to find a solution for task scheduling ,pls give me a detailed solution,asps.
thanks in advance.
alex.
Alex Malayil
malayilalex@gmail.com
|
|
|
|
|
Sorry, this is the wrong place.
If you want to know why your code is not working, or how you can retrieve the full path of a file from a string, or so on and so forth, this is the best place. You are asking for a detailed solution - we don't try that here.
Try RentACoder - I'm sure Christian Graus will give a glowing recommendation.
Cheers,
Vikram. "When I read in books about a "base class", I figured this was the class that was at the bottom of the inheritence tree. It's the "base", right? Like the base of a pyramid." - Marc Clifton.
|
|
|
|
|
You mean you want to create a scheduled task using C#?
If so just create a process in C# to run Schtask.exe.
|
|
|
|
|
Hi All,
I have looked at so many threading samples my head hurts.
What I want to do is load data into a treeview control but my form hangs. Is there a way to load data into the treeview while the form loads??
I have tried some threading samples but have had issues with them. One I got to work but the form still hung (using a delegate and invoke)
Any help would be appreciated.
Thanks
|
|
|
|
|
The most common problem is accessing UI elements from another thread. This[^] article might shed some light on it. Could you post the relevant piece of code?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thanks. Good Article. The slowness was in my code. Once I cleaned it up it was perfect.
|
|
|
|
|
Hi All,
Can any one help me how to interact with Dallas IButton, how to recognise whether the button is present or not and read the data from the iButton, my requirement is to allow the user to login to the application if the IButton is present and valid, logout the user once the ibutton is removed from the slot.
Note: the iButton is a physical device for the user
Thanks in Advance
Krishna
|
|
|
|
|
For third-party hardware or software you should consult with the manufacturer. This site is intended more for general help with technologies listed in the forums page (like C# here on this forum). It's unlikely that anyone who regularily responds here would know much about it, but the manufacturer site may have more developer information or you might even be able to find a newsgroup or unofficial site talking about the technology in question.
This is especially true since you're asking about application programming interfaces to the hardware, which should be documented either in product documentation for the device or in a separate, downloadable software development kit from the manufacturer's web site.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
why is this simple operation giving me so much trouble?
also when it tried to load the xml, it attempts to connect to the internet to get to the dtd. can i avoid this?
the error i get at the moment is 'root element missing';
i did try and create this template using XmlNodes but i couldnt find a way to add the doctype node, if anyone can shed any light on that, that may be the way to do it.
<pre>
private XmlDocument LoadStrictXhtmlTemplate()
{
XmlDocument doc = new XmlDocument();
doc.LoadXml("<?xml version='1.0' ?>");
doc.LoadXml("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">");
doc.CreateComment(this.m_CreatedComment);
doc.LoadXml("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
doc.LoadXml("<head>");
doc.LoadXml("<title>" + this.m_Title + "</title>");
doc.LoadXml("</head>");
doc.LoadXml("<body>");
doc.LoadXml("</body>");
doc.LoadXml("</html>");
return doc;
}
</pre>
kind regards,
g00fy
|
|
|
|
|
Well, you can't use LoadXML[^] repeatedly to load parts of a single XML document. You need to use it like
string x = "<?xml version='1.0' ?>";
x += "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" "http:
...
doc.LoadXML(x);
You might want to use StringBuilder instead of string to build the XML document..
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
of course,
stupid mistake on my part, thank you for being so kind to my .
obviously it must still connect to the internet to verify the DTD as well unless i copy that local, but for this application, it is not imperative that the html be validated strict.
kind regards,
g00fy
my final solution is as follows for anyone elses reference.
private XmlDocument LoadStrictXhtmlTemplate()
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("<?xml version='1.0' ?>");
// next line commented out as it takes about 10 seconds to throw the WebException
//sb.AppendLine("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0
// Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">");
sb.AppendLine("<!-- " + this.m_CreatedComment + " -->");
sb.AppendLine("<html>"); // xmlns=\"http://www.w3.org/1999/xhtml\">");
sb.AppendLine("<head>");
sb.AppendLine("<title>" + this.m_Title + "</title>");
sb.AppendLine("</head>");
sb.AppendLine("<body id=\"start\">");
sb.AppendLine("</body>");
sb.AppendLine("</html>");
XmlDocument doc = new XmlDocument();
doc.LoadXml(sb.ToString());
return doc;
}
|
|
|
|
|
Hi everyone,
I am newbie in C# and I have a doubt in retrieving the values from database based on search criteria. It is working well in vb.net but i am facing problem in C# i am writing the codes both in vb.net and c# please anyone help me where i am going wrong....
vb.net code:
connectdb()
cmd.commandtext="select * from Emp where sno="& val(textbox1.text)
da.selectcommand=cmd
da.fill(ds,"Emp")
for each dr in ds.tables("Emp").Rows
If val(textbox1.text)=dr.Item(0) then
textbox1.text=dr.item(0)
textbox2.text=dr.item(2)
textbox3.text=dr.item(2)
textbox4.text=dr.item(3)
end if
next
con.close()
C# code:
try
{
dbconnect();
Cmd.CommandText = " Select * from Emp where Empno=" + Convert.ToInt32(TextBox1.Text);
da.SelectCommand = Cmd;
da.Fill(ds, "Emp");
dt=ds.Tables["Emp"];
foreach ( DataTable table in ds.Tables )
{
foreach (DataRow dr in ds.Tables["Emp"].Rows) {
if (Convert.ToInt32(TextBox1.Text) = row["Empno"].ToString())
{ TextBox1.Text = row["Empno"].ToString;
TextBox2.Text = row["Name"].ToString;
TextBox3.Text = row["Dept"].ToString;
TextBox4.Text = row["Salary"].ToString;
}
}
}
catch (Exception ex)
{
Response.Redirect(ex.Message);
}
Con.Close();
}
the error in c# is that 'row' is not a member of data.
What is the equivalent code of dr.item in vb.net to c#
anyone please help me
thanks inadvance
|
|
|
|