|
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
|
|
|
|
|
1. If you're going to use only the Emp table, why recurse through all that is in the DataSet? Just do
foreach(DataRow dr in dt)
{
}
2. Also, you've put a WHERE clause in your SELECT query itself, so why do you want to check it in the loop?
3. When you create the query, check if it's indeed a number, and then simply append it to the query.
4. ToString() is a method. I don't know how you were able to compile your code.
5. You're using a very dangerous way of creating queries. Google for sql injection attacks .
HTH.
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.
|
|
|
|
|
hi thanx for responding after i modified my code as u said like this
foreach (DataRow dr in ds.Tables["Emp"].Rows)
{
if (Convert.ToInt32(TextBox1.Text) = dr["Empno"].ToString())
{
TextBox1.Text = dr["Empno"].ToString();
TextBox2.Text = dr["Name"].ToString();
TextBox3.Text = dr["Dept"].ToString();
TextBox4.Text = dr["Salary"].ToString();
}
}
I am getting the following errors at if statement
Cannot implicitly convert type 'int' to 'bool'
Cannot implicitly convert type 'string' to 'int'
The left-hand side of an assignment must be a variable, property or indexer
Help me plz
thanx
|
|
|
|
|
In your VB Example you were iterating over the Rows in the Emp table:
for each dr in ds.tables("Emp").Rows
In your C# example, you are itterating over the Tables in the dataset
foreach ( DataTable table in ds.Tables )
and then itterating over the Rows in the Emp table
foreach (DataRow dr in ds.Tables["Emp"].Rows)
which is pointless, because you only read from the Emp table! So you'll be reading once for every table in your dataset.
Your real problem is that as above you named the rows dr , but then you try to read from a variable called row
<br />
TextBox1.Text = row["Empno"].ToString
In addition, C# requires the use of the open and closed brackets for method calls (one small difference from VB, which allows you to call methods without parenthesis)
|
|
|
|
|
another one
Convert.ToInt32(TextBox1.Text) = row["Empno"].ToString()
this is the wrong way round - it should simply be
TextBox1.Text = row["Empno"].ToString()
|
|
|
|
|
hi thanx for responding after i modified my code as u said like this
foreach (DataRow dr in ds.Tables["Emp"].Rows)
{
if ((TextBox1.Text) = dr["Empno"].ToString())
{
TextBox1.Text = dr["Empno"].ToString();
TextBox2.Text = dr["Name"].ToString();
TextBox3.Text = dr["Dept"].ToString();
TextBox4.Text = dr["Salary"].ToString();
}
}
I am getting the following errors at if statement
Cannot implicitly convert type 'string' to 'bool'
help me plz
thanx
|
|
|
|
|
Equality is a double equals in C#
if ((TextBox1.Text) = dr["Empno"].ToString())
should be
if ((TextBox1.Text) == dr["Empno"].ToString())
|
|
|
|
|
hi
thanx, it is working thanx for ur suggestion
thanxonce again
|
|
|
|
|
What is Schema.ini?(Know little,want more)...
I want to export a database content to textfile...For implementing this, how schema.ini helps in defining the text qualifiers for the different type of fields....(ie. in case of Strings "",in case of Numbers no qualifiers...)
Kindly help me...
-- modified at 0:00 Friday 16th December, 2005
|
|
|
|
|
Ok, this is a simple question, but I've tried and looked and just can't seem to come up with an answer...
In my VB6 app, I can create an array of controls simply by copy and pasting for the default "do you want to make this object an array" prompt...
In C#, I get no prompt, and no menu option (that I can see.. maybe I'm blind) to make an array.
I simply want to be able to create an array of x number of checkboxes (or any control, for that matter) in a panel so I can cycle through them with an iteration statement... What am I missing? If this involves more code than using iteration would save, just tell me and I'll move on.
Thanks in advance.
|
|
|
|
|
Ok...
I found the C# tutorial on how to create a group of controls from a string array... Is this the only way to create and use an array of controls? I'd really much prefer to have them available at design time, not to mention having to plot their location every time I want to create another array of controls. I find it hard to believe that .NET would make something that seems so fundamental such a pain in the arse...
|
|
|
|
|
"control arrays" per se are not supported by the VS.NET designer. However, it's easy to manually build an array containing controls that are on your form:
CheckBox[] checkBoxes=new CheckBox[]{myCheckBox1, myCheckBox2, ...};
If you need dynamically created control arrays that will be resized at runtime to an arbitrary size, you will need to create the checkboxes manually and add them to a list:
List<CheckBox> checkBoxes = new List<CheckBox>();
for(int i=0;i<myCount;i++)
{
CheckBox checkBox = new CheckBox();
checkBox.Location = new Point(10,10+(20*i));
checkBox.Size = new Size(50, 20);
checkBox.TabIndex=i;
checkBox.Text="CheckBox "+i.ToString();
panel.Controls.Add(checkBox);
checkBoxes.Add(checkBox);
}
|
|
|
|