|
I want to add many items after scan them one by one from database into datatable
public void CheckItem( string itemcode)
{
string constring = @"Data Source=.;Initial Catalog=pos;User id = sa;password=123";
SqlCommand objCmd = new SqlCommand();
objCmd.Parameters.Clear();
using (SqlConnection objCnn = new SqlConnection(constring))
{
objCnn.Open();
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();
dt.Load(myreader);
decimal sumprice=0;
if (dt.Rows.Count <= 0)
dt = objDT.NewRow();
dt.Columns.Add("", typeof(decimal));
dataGridView1.DataSource = dt;
}
}
}
|
|
|
|
|
I suggest moving the instantiation of the datatable to a class level (outside of you method) and each time you populate dt you add the dt rows to the class level table.
The class level table is the one that will be bound to your DGV
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
anyone cal add code in this for that
public class VerticalForceGraph
{
private List<verticalforce> vtfList = new List<verticalforce>();
public int BufferSize { get; set; }
public void Add(VerticalForce vtf)
{
vtfList.Add(vtf);
// remove first item if condition
if(vtfList.Count > BufferSize)
{
// vtfList.RemoveRange(1, 1);
vtfList.RemoveAt(0);
}
}
public int[] GetLeftVTF()
{
return vtfList.Select(x => x.Left).ToArray();
}
public int[] GetRightVTF()
{
return vtfList.Select(x => x.Right).ToArray();
}
public int[] GetTotalVTF()
{
return vtfList.Select(x => x.Total).ToArray();
}
}
// and i want to cal it here and draw graph
private void VtfGraphicalViewMode(Graphics graphics)
{
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;
//Display title
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);
graphics.SmoothingMode = SmoothingMode.AntiAlias;
graphics.DrawRectangle(outline, new Rectangle(heatmapCoord_X, heatmapCoord_Y, heatmapWidth, heatmapHeight));
Rectangle graph_area = new Rectangle(heatmapCoord_X, heatmapCoord_Y, heatmapWidth, heatmapHeight);
graphics.FillRectangle(Brushes.LightBlue, graph_area);
graphics.DrawString("VTF Grahical View",
title_font, Brushes.Blue,
title_center, string_format);
graphics.DrawString("Left VTF", leftfornt, Brushes.Blue, titleleft, string_format);
//Y-axis
int xOffset = 50;
int yOffset = 20;
graphics.DrawLine(Pens.Blue,
heatmapCoord_X + xOffset, heatmapCoord_Y + (heatmapHeight - 50),heatmapCoord_X + xOffset, heatmapCoord_Y + yOffset
);
//X-axis
graphics.DrawLine(Pens.Blue,
heatmapCoord_X + (heatmapWidth - 10), heatmapCoord_Y + (heatmapHeight - 50), heatmapCoord_X + xOffset, heatmapCoord_Y + (heatmapHeight - 50)
);
|
|
|
|
|
You haven't described a problem at all as your "question" makes no sense. Your code makes even less sense.
We have no idea what you're having a problem with or what you're asking.
|
|
|
|
|
namespace VistaBalanceAlgorithms
{
public class VerticalForce
{
public static float SteadyStateTotalForce = 1;
public static bool SteadyState = false;
public VerticalForce(float[] frameValues)
{
Left = 0;
Right = 0;
Total = 0;
if (frameValues != null)
{
float leftForce = frameValues.Take(frameValues.Length / 2).Sum();
float rightForce = frameValues.Skip(frameValues.Length / 2).Sum();
Left = (int)((leftForce / SteadyStateTotalForce) * 100);
Right = (int)((rightForce / SteadyStateTotalForce) * 100);
Left = Left < 0 ? 0 : Left;
Right = Right < 0 ? 0 : Right;
Total = Left + Right;
}
}
public int Left { get; protected set; }
public int Right { get; protected set; }
public int Total { get; protected set; }
}
public class VerticalForceGraph
{
private List<VerticalForce> vtfList = new List<VerticalForce>();
public int BufferSize { get; set; }
public void Add(VerticalForce vtf)
{
vtfList.Add(vtf);
if(vtfList.Count > BufferSize)
{
vtfList.RemoveAt(0);
}
}
public int[] GetLeftVTF()
{
return vtfList.Select(x => x.Left).ToArray();
}
public int[] GetRightVTF()
{
return vtfList.Select(x => x.Right).ToArray();
}
public int[] GetTotalVTF()
{
return vtfList.Select(x => x.Total).ToArray();
}
}
}
here i want to cal it on another class
//here i only created rectangle inside panel and draw x and y acc to panel scale
private void HeatmapViewMode(Graphics graphics)
{
graphics.SmoothingMode = SmoothingMode.AntiAlias;
graphics.DrawRectangle(borderPen, new Rectangle(heatmapCoord_X, heatmapCoord_Y, heatmapWidth, heatmapHeight));
Pen semiTransPen = new Pen(Color.FromArgb(128, 0, 0, 255), 3);
var points = m_CopTail.GetPoints().Select(c => { c.X = c.X - m_AutocenterOffsetX; c.Y = c.Y - m_AutocenterOffsetY; return c; }).ToArray();
if (points != null && points.Length > 1)
{
SizeF copPointSize = new SizeF(10, 10);
SizeF centerOffset = new SizeF(copPointSize.Width / 2, copPointSize.Height / 2);
PointF copPoint = new PointF(COP.X - m_AutocenterOffsetX - centerOffset.Width,
COP.Y - m_AutocenterOffsetY - centerOffset.Height);
graphics.FillEllipse(Brushes.Red, new RectangleF(copPoint, copPointSize));
if (m_CopTail.TimeRange.TotalSeconds > 0)
graphics.DrawCurve(semiTransPen, points);
if ((Mode == ModeOfOperation.STABILITY_MODE && m_CopTail.HasAutoCenter() == true) ||
(m_CopTail.HasAutoCenter() == true && CopArrow == true))
{
PointF centerPoint = new PointF(heatmapCoord_X + heatmapWidth / 2f,
heatmapCoord_Y + heatmapHeight / 2f);
PointF endPoint = new PointF(copPoint.X + centerOffset.Width, copPoint.Y + centerOffset.Height);
var distance = Math.Sqrt(Math.Pow((centerPoint.X - endPoint.X), 2) + Math.Pow((centerPoint.Y - endPoint.Y), 2));
float triggerZoneDiameter = 30f;
StabilityTriggerZoneDraw(graphics, triggerZoneDiameter, distance > triggerZoneDiameter);
graphics.DrawLine(stabilityArrowPen, centerPoint, endPoint);
}
if (heatmap != null)
heatmap.Draw(graphics, heatmapCoord_X - m_AutocenterOffsetX, heatmapCoord_Y - m_AutocenterOffsetY, 80);
}
}
|
|
|
|
|
It's "calibrate", not "cal". Yes, it makes a difference when talking to other people who are not involved in your project.
So, what's the problem? You still haven't described the problem you're having.
|
|
|
|
|
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.
Ronald Richards
|
|
|
|
|
And?
What have you tried?
Where are you stuck?
What help do you need?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
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
Ronald Richards
|
|
|
|
|
Well you answer you own question!
Member 13364520 wrote: When the program starts, the BackColor of the form and each of the 3 labels should be black.
Member 13364520 wrote: On Label1,Label2,Label3; BackColor = White & ForeColor = ControlText(black).
So set the BackColor of the Labels to Black...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Welcome to CodeProject !
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)
|
|
|
|
|
Hi,
if a Controls foreground and background colors equal its parents background color, would you call it visible?
|
|
|
|
|
If an application crashes in a forest, does anyone notice the BSoD?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
That is exactly why Win10 "BSoD" got switched to green
|
|
|
|
|
Only if it's black on a black background, a small black light lights up black.
This space for rent
|
|
|
|
|
Pete, you just revealed the first famous quote; can you discover the other two as well? without hovering?
|
|
|
|
|
I attempted to hover once. I managed it for less than half a second.
Okay. It was a jump. I jumped, but let's call it hovering for the sake of avoiding edge cases.
This space for rent
|
|
|
|
|
Pete O'Hanlon wrote: I managed it for less than half a second. The secret is in the time.
David Eddings, Magicians Gambit : “What was that?" Belgarath asked, coming back around the corner.
"Brill," Silk replied blandly, pulling his Murgo robe back on.
"Again?" Belgarath demanded with exasperation. "What was he doing this time?"
"Trying to fly, last time I saw him." Silk smirked.
The old man looked puzzled.
"He wasn't doing it very well," Silk added.
Belgarath shrugged. "Maybe it'll come to him in time."
"He doesn't really have all that much time." Silk glanced out over the edge.
From far below - terribly far below - there came a faint, muffled crash; then, after several seconds, another. "Does bouncing count?" Silk asked.
Belgarath made a wry face. "Not really."
"Then I'd say he didn't learn in time." Silk said blithely.”
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
only in the surrender of the light could the darkness prevail.
|
|
|
|
|
Please explain! I noticed as I set the BackColor of the Labels white, and Form1 having a black BackColor; in runtime when I hover over a label, the whole back ground color of Form1 turns white. Now this is the problem, because the form is always suppose to stay black when the labels should be darkened (black) until the user hovers a mouse pointer over it to lighten it up - revealing the quotes. So, I changed the BackColor setting of the labels to black; now the whole form is Black, but as I Run the program and hover my mouse over a label nothing happens,i.e, the labels stays black as well as the form. How can I tweak this program to get the results required in runtime?
Ronald Richards
|
|
|
|
|
It's a quote from the Hitchhiker's Guide to the Galaxy:
Hitchhiker's Guide Quotes (‘It’s the wild colour scheme that freaks me out,’...)[^]
It's a jokey response to Luc's slightly tounge-in-cheek response to your original question:
if a Controls foreground and background colors equal its parents background color, would you call it visible?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
C# codes is exist below.I am trying to query like in below the codes.I am creating queries via web service using xml.You can see below the codes
karthareket.kk_no colum name when I run this codes visual studio give an error.You can see error below.May you help me?
error picture here
private void KKTahsilat()
{
sql = "SELECT bnisim_ad, kk_adi, cr_adi, DATE_FORMAT(kk_odemetarih,'%d.%m.%Y') AS islemtarih, DATE_FORMAT(bh_tarih,'%d.%m.%Y') AS vadetarih, bh_tutar,bh_tutarbirim, kk_taksitsay, bh_slipdetay as taksit,
bh_tur, kk_belgeno, kk_tutar FROM tbodeme2017,tbkasa2017, (tbbankahareket2017, tbkredikart2017) LEFT JOIN tbbankakredikartiplan ON (kk_planid=bkp_id)
LEFT JOIN tbbankakredikartiplantaksit ON (bkpt_planid=bkp_id AND bkpt_taksit=bh_slipdetay), tbcari,tbbankaisim,tbbanka,tbbankakredikarti
where od_izahat=kk_izahat AND od_satisno=bh_islemno AND ka_islemad=kk_izahat AND ka_stno=bh_islemno AND tbkredikart2017.kk_no=bh_islemno AND cr_no=tbkredikart2017.kk_musno AND bn_bankano = bnisim_id AND bkredikart2017.kk_bankano = bn_id AND tbkredikart2017.kk_posid = tbbankakredikarti.kk_no AND bh_tur LIKE 'Kredi Kartı Tahsilat' ";
response = veri.exportDataXML(login, sql);
XmlDocument xmlcari = new XmlDocument();
xmlcari.LoadXml(response);
XmlNodeList isim = xmlcari.SelectNodes("table/rows/row");
kkTahsilat = 0;
foreach (XmlNode node in isim)
{
kkTahsilat += XmlConvert.ToDouble(node.ChildNodes[5].InnerText);
}
}
namespace Livella_Cek.webservis {
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace="urn:WebticariService", ConfigurationName="webservis.WebticariServicePortType")]
public interface WebticariServicePortType {
[System.ServiceModel.OperationContractAttribute(Action="urn:WebticariService#exportDataXML", ReplyAction="*")]
[System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults=true, Use=System.ServiceModel.OperationFormatUse.Encoded)]
[return: System.ServiceModel.MessageParameterAttribute(Name="return")]
string exportDataXML(string token, string query);
}
public string exportDataXML(string token, string query) {
return base.Channel.exportDataXML(token, query);
}
}
|
|
|
|
|
The code you have shown above does not match the code in the error message display.
|
|
|
|
|
Can you tell why the error was caused by considering the error picture?
|
|
|
|
|
Sorry, but I have looked again, and checked the documentation and cannot see what is wrong.
|
|
|
|
|