|
Pro C# and the .NET framework is a good one, but Wrox and Adison Wesley both publish generally execlent books. Avoid anything with multiple exclamation marks, "in xxx days", or "for dummies" in the title.
If possible, get something in your native language (whatever that is) - it's a lot easier to understand new material when you don't have to try and translate new terms at the same time!
But whatever book you get, start at the beginning, and work through: do the exercises, even if they seem trivial - you learn best by doing, not reading the answers. Books tend to be organised so they build on previous material, and skipping a chapter or two can mean that you miss a lot of useful stuff!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Pick one for yourself: Useful Reference Books[^]
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
very good,i am reading,3q
|
|
|
|
|
And don't post the same thing twice in 3 minutes (or at all) - it'll just get deleted again...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
|
If you can understand the English, you could read the reviews of that book on Amazon: [^].
That book was published in 2010, and there are a lot of new developments in .NET and C# since then.
If you say more about the level of understanding and coding you are at now, perhaps you can get a recommendation for a more recent book.
cheers, Bill
«What we observe is not nature itself, but nature exposed to our method of questioning» Werner Heisenberg
|
|
|
|
|
oh~I have reply you 2 days ago,but because of net delay not display up,sorry.I read reviews about it on DangDang,very good.bye the way,I just write a small program which would auto check my bbs's register users,not very complex,so it is enough,I think,hehe.Thank you very much,anyway
|
|
|
|
|
when i add shockwave flash object from COM the visual studio was restarting
|
|
|
|
|
And how that related to C#?
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
how to connected database using c# language with web application asp.net
|
|
|
|
|
|
My purpose in below program is getting 16 bytes of data from microcontroller and processing data for appropriate instructions. There are a lot of related questions and answers here but I couldnt find anything about in below issue. I can get 16 bytes from MCU. Values of bytes are correct and I can see them in dataGridView but the sequence of bytes is changing . For example at first MCUData[0] = 0x01 , MCUData[1] = 0xFE , MCUData[2] = 0xCC then it changes to MCUData[0] = 0xFE , MCUData[1] = 0xCC , MCUData[2] = 0x01. İt is like some problem shifting my datas in byte array. I am sure my MCU is sending data correctly because I checked in one of serial terminal program. My code is in below
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO.Ports;
using System.Threading;
namespace SerialCommunicationMCU
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
dataGridView1.Columns.Add("MCUData", "Byte Name");
dataGridView1.Columns.Add("MCUData", "Byte Value");
}
public System.IO.Ports.SerialPort SerialPc;
#region Variables
public string AvailablePort;
public string[] Ports = SerialPort.GetPortNames();
byte[] MCUData = new byte[16];
#endregion
private void Connect_Click(object sender, EventArgs e)
{
DataGreedByteNameShow();
SerialConnectandRead();
ConnectButton.Enabled = false;
DisconnectButton.Enabled = true;
}
private void Disconnect_Click(object sender, EventArgs e)
{
SerialPc.Close();
ConnectButton.Enabled = true;
DisconnectButton.Enabled = false;
}
public void SerialConnectandRead()
{
SerialPc = new SerialPort(AvailablePort, 115200, Parity.None, 8, StopBits.One);
try
{
SerialPc.Open();
SerialPc.DataReceived += new SerialDataReceivedEventHandler(SerialPc_DataReceived);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Serial Port Error");
}
}
private void SerialPc_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
SerialPc.DiscardNull = false;
SerialPc.Read(MCUData, 0, 16);
SerialPc.ReceivedBytesThreshold = 16;
DataGreedByteValueShow();
}
private void Form1_Load(object sender, EventArgs e)
{
foreach (string port in Ports)
{
comboBox1.Items.Add(port);
}
DisconnectButton.Enabled = false;
}
public void DataGreedByteNameShow()
{
dataGridView1.Rows.Add("MCUData[0]");
dataGridView1.Rows.Add("MCUData[1]");
dataGridView1.Rows.Add("MCUData[2]");
dataGridView1.Rows.Add("MCUData[3]");
dataGridView1.Rows.Add("MCUData[4]");
dataGridView1.Rows.Add("MCUData[5]");
dataGridView1.Rows.Add("MCUData[6]");
dataGridView1.Rows.Add("MCUData[7]");
dataGridView1.Rows.Add("MCUData[8]");
dataGridView1.Rows.Add("MCUData[9]");
dataGridView1.Rows.Add("MCUData[10]");
dataGridView1.Rows.Add("MCUData[11]");
dataGridView1.Rows.Add("MCUData[12]");
dataGridView1.Rows.Add("MCUData[13]");
dataGridView1.Rows.Add("MCUData[14]");
dataGridView1.Rows.Add("MCUData[15]");
}
private void DataGreedByteValueShow()
{
dataGridView1.Rows[0].Cells[1].Value = MCUData[0];
dataGridView1.Rows[1].Cells[1].Value = MCUData[1];
dataGridView1.Rows[2].Cells[1].Value = MCUData[2];
dataGridView1.Rows[3].Cells[1].Value = MCUData[3];
dataGridView1.Rows[4].Cells[1].Value = MCUData[4];
dataGridView1.Rows[5].Cells[1].Value = MCUData[5];
dataGridView1.Rows[6].Cells[1].Value = MCUData[6];
dataGridView1.Rows[7].Cells[1].Value = MCUData[7];
dataGridView1.Rows[8].Cells[1].Value = MCUData[8];
dataGridView1.Rows[9].Cells[1].Value = MCUData[9];
dataGridView1.Rows[10].Cells[1].Value = MCUData[10];
dataGridView1.Rows[11].Cells[1].Value = MCUData[11];
dataGridView1.Rows[12].Cells[1].Value = MCUData[12];
dataGridView1.Rows[13].Cells[1].Value = MCUData[13];
dataGridView1.Rows[14].Cells[1].Value = MCUData[14];
dataGridView1.Rows[15].Cells[1].Value = MCUData[15];
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
AvailablePort = comboBox1.SelectedItem.ToString();
}
}
}
modified 10-Jan-15 18:35pm.
|
|
|
|
|
Difficult to guess what is happening, but it is possible your event handler is being called repeatedly and changing the data. Maybe called for every byte received. The only way to find out would be to use your debugger to trace the exact sequence of events.
|
|
|
|
|
I realized that at the starting , my code works well. I mean all 16 bytes of data are correct and in correct sequence. But when it performs 2nd operation , only the sequence is changing. The values are correct. I think emptying buffer after each operation would be appropriate. I can use DiscardInBuffer() method but can you suggest me other effective solution if you know ?
|
|
|
|
|
There is a problem here, which is likely to be that you don't really understand serial ports that well.
When a character arrives on a serial port, you will get a DataReceived event - that doesn't mean that 16 bytes are immediately available: serial ports are slow, and it is very likely that the event will be handled when there is only one character actually available. So trying to read 16 bytes every time the event gets signalled is not likely to do exactly what you want...
And if you read the documentation, the DataReceived event handler is never executed on the UI thread - so adding data to controls is a very, very bad idea.
Instead, consider reading the available bytes into the array and appending them, and then checking to see if you have them all. If you do, then your main process thread can work on the data, rather than the DateReceived thread.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I used SerialPort object from toolbox instead of identify in code, it works correctly now. Thanks for your help
|
|
|
|
|
<button id="asss" onclick="getspeack('hello manh tuyen')">noi thu</button>
<script type="text/javascript">
function getspeack(textvoid)
{
var msg = new SpeechSynthesisUtterance();
var voices = window.speechSynthesis.getVoices();
msg.voice = voices[10]; // Note: some voices don't support altering params
msg.voiceURI = 'native';
msg.volume = 1; // 0 to 1
msg.rate = 1; // 0.1 to 10
msg.pitch = 2; //0 to 2
msg.text = textvoid;
msg.lang = 'en-US';
speechSynthesis.speak(msg);
}
</script>
|
|
|
|
|
And?
What does it do that you didn't expect, or not do that you did?
Remember that we can't see your screen, access your HDD, or read your mind.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
That's JavaScript, not C#. Please take the question to a more appropriate forum.
|
|
|
|
|
That my friend seems more like a JavaScript code, so trying to write the C# code in it won't work at all.
If you really want to write the application, then please, wasting no time at all go to this documentation[^].
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Hi,
I am outputting log style info into a multiline textbox. I have the vertical and horizontal scrollbar property enabled. At runtime when data is added to the multiline textbox, I can see the scrollbars but they cannot be moved.
Do I need to do something more to make them actually work?
Thanks,
Rob
|
|
|
|
|
The scrollbars should work once there is more text in the textbox than it can show, when the application is running and the textbox'Enabled property is set to "true".
A disadvantage will be the speed of adding stuff to the textbox; consider using a listbox once you encounter that problem.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I found that the textbox Enabled property was set to false. I set it to true and now the scrollbars work properly. I just assumed that it was enabled by default. I thought that was true for all controls but you have changed my mind!
Thank you!
|
|
|
|
|
robwm1 wrote: I just assumed that it was enabled by default It is
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I must have changed it at some point. This is my first C# project and I have done a lot of experimentation. Just need to remember to undo any changes I make that don't give the results I am looking for so everything remains in its default state.
I am my own job security...
|
|
|
|