Why is that giving you difficulty?
It's pretty trivial: loop through each character in the input.
if the previous char was a digit, then if the current is also a digit, convert them both to a single value and add them to the output and continue with the next character. If not, add the last digit to the output as a nibble. (i.e. '0' becomes a 0 byte, '1' becomes a 1 byte, ...
If the current char is a digit, save it for next time.
If it isn't, add it directly to the output.
After the loop finishes, check if the last character was an un-output digit and output if needed.
One loop, a bool, a byte variable, and a List<byte> to output to: this isn't a complex operation, and shouldn't take a developer more than a couple of minutes to write...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
I want to add many items after scan them one by one from database into datatable
publicvoid CheckItem( string itemcode)
string constring = @"Data Source=.;Initial Catalog=pos;User id = sa;password=123";
SqlCommand objCmd = new SqlCommand();
using (SqlConnection objCnn = new SqlConnection(constring))
using (objCmd = objCnn.CreateCommand())
objCmd.CommandType = CommandType.Text;
objCmd.CommandText = "SELECT * FROM Items where Item_Code=@Item_Code";
objCmd.Parameters.Add(new SqlParameter("@Item_Code", itemcode));
SqlDataReader myreader = objCmd.ExecuteReader();
DataTable dt = new DataTable();
if (dt.Rows.Count <= 0)
// here i want to add new item into datatable , after that bind the new item with items that i added before
dt = objDT.NewRow();
dataGridView1.DataSource = dt;
Pen yellowPen = new Pen(Color.Yellow, 2);
Pen bluePen = new Pen(Color.Blue, 2);
Pen redPen = new Pen(Color.Red, 2);
int hOffset = heatmapWidth / 2;
int vOffset = heatmapHeight / 2;
using (Font title_font = new Font("Times New Roman", 20))
using (StringFormat string_format = new StringFormat())
string_format.Alignment = StringAlignment.Center;
string_format.LineAlignment = StringAlignment.Center;
Point title_center = new Point(this.heatmapWidth / 2, 20);
Point titleleft = new Point(this.heatmapHeight / 4, heatmapWidth/10);
Font leftfornt = new Font("Times New Roman", 10);
Font totalfont = new Font("Times New Roman", 10);
Font rightfont = new Font("Times New Roman", 10);
I need to get 'Form1' to retain its black back-ground color while the 3 labels with a white BackColor displaying famous quotes are not visible (Form1 totally black) until a mouse pointer hovers over a label and reveals the famous quote(s) during the execution of runtime.
I followed the instructions that tells me to put three labels to the form each displaying a famous quote. When the program starts, the BackColor of the form and each of the 3 labels should be black. Now, as the user passes or hovers the mouse pointer over a label it should change the label's BackColor white thus revealing the quote. The results I get is not the same. That is, when the program starts the BackColor of the form is black, but the 3 labels do not have a black back ground at all. Instead, all the labels on the form are visible (showing quotes) with a white BackColor. Now, as I hover my mouse pointer over each label the back ground color of the form turns white and as I release the pointer from the label(s) the back ground color of the form returns to black.// The control settings in the properties window are: On Form1; BackColor = ControlText(black) & ForeColor = ControlText(black)// On Label1,Label2,Label3; BackColor = White & ForeColor = ControlText(black). In the Events window settings are:On Form1; Load = Form1_Load & MouseHover = Form1_Load// On Label1,Label2,Label3; MouseHover = Label1,2,3_MouseHover
Questions here need to have more detail than what you've written. At the least, share the ideas you have for this project: what is required to sense the mouse moving over a Control which is not visible ?
Hint: examine the Rectangle.Contains method.
«While I complain of being able to see only a shadow of the past, I may be insensitive to reality as it is now, since I'm not at a stage of development where I'm capable of seeing it. A few hundred years later another traveler despairing as myself, may mourn the disappearance of what I may have seen, but failed to see.» Claude Levi-Strauss (Tristes Tropiques, 1955)</