|
Hi guys;
I have a question; I am using SQL dataadapter to run a stored procedure of which I am filling the result into a dataset as follows:
DataSet ds=new DataSet();
adp.Fill(ds,"tbACJE");
then I am running the following code:
if(ds.Tables["tbACJE"].Rows.Count>1)
{
What I would like to do from there is to find/compare the sum of 2 columns. i.e CreditColumn and DebitColumn. Could you guys help me on how I could do that please.
Thanks in advance.
sasa
|
|
|
|
|
ds.Tables["tbACJE"].Compute("SUM(Credit + Debit)", "<filter>");
only two letters away from being an asset
|
|
|
|
|
Thanks Mark for your help.
I have another question please on this. After I get the sum; I would like to run and If/else statement where if Sum=0 than do nothing else Pass the Sum of Credit and pass the sum of debit.
By pass I mean
System.Data.DataRow rd= ds.Tables["tbACJE"].Rows[0];
Double fTemp= Double.Parse(rd[0].ToString()); //rd[0] is the Debit Column.
Please help.
sasa
|
|
|
|
|
I am creating a windows application from a pdf. Actually I am bringing a pdf document into a windows form as a background image and adding controls to be able to populate the form from a database. My goal is to be able to print a copy of the populated form and then save it as a pdf. Does anyone have an idea on how I can do this. Print the form or save as a pdf.
Thanks in advance!
|
|
|
|
|
|
I have this for an array of pictureboxes:
GradPic[i].MouseClick += new MouseEventHandler(GradPic_MouseClick);
GradPic[i].MouseDoubleClick += new MouseEventHandler(GradPic_MouseDoubleClick);
private void GradPic_MouseClick(object sender, MouseEventArgs e)
{
this.GradLabel[selectedGradLabel].ForeColor = System.Drawing.Color.Black;
for (int i = 0; i < GradPic.Length; i++)
{
if (GradPic[i] == (PictureBox)sender)
{
selectedGradLabel = i;
this.GradLabel[selectedGradLabel].ForeColor = System.Drawing.Color.Red;
}
}
}
private void GradPic_MouseDoubleClick(object sender, MouseEventArgs e)
{
for (int i = 0; i < GradPic.Length; i++)
{
if (GradPic[i] == (PictureBox)sender)
{
if (currentView == "Astronauts") ShowAstronautBio();
else ShowGraduateClassPhoto();
}
}
}
Which works fine. I have a similar approach to a different array of pictureboxes, only now the DOUBLECLICK event fires only if I rem out the mouseclick assignment. Anybody have any ideas?
ACThumbBox[i].MouseClick += new MouseEventHandler(ACThumbBox_MouseClick);
ACThumbBox[i].MouseDoubleClick += new MouseEventHandler(ACThumbBox_MouseDoubleClick);
private void ACThumbBox_MouseClick(object sender, MouseEventArgs e)
{
this.ACThumbBox[acGridCurrent].BorderStyle = BorderStyle.None;
for (int i = 0; i < ACThumbBox.Length; i++)
{
if (ACThumbBox[i] == (PictureBox)sender)
{
acGridCurrent = i;
this.ACThumbBox[acGridCurrent].BorderStyle = BorderStyle.FixedSingle;
}
}
}
private void ACThumbBox_MouseDoubleClick(object sender, MouseEventArgs e)
{
DisplayAircraftWebPage();
}
|
|
|
|
|
Have you tried altering what the function does. Like comment out "DisplayAircraftWebPage();" and just putting instead a MessageBox.Show call to see if the event is the problem or whether the DisplayAircraftWebPage() method is the problem. Or you if the control is being designed, check to make sure all the designer event handlers are set to the proper event.
|
|
|
|
|
I put in a breakpoint, it isn't even going to it. If I rem out the single mouse click assignment it works find.
|
|
|
|
|
|
Hi, I'm writing a chat client in C# for the CyanChat protocol, using a TcpClient and C# sockets. All messages sent have the format "XX|message\r\n", where XX is a message ID code.
My problem is that my client is only receiving the first message. Messages sent out are sent properly, but only one message is ever received and shown.
public void GetMsg(IAsyncResult ar)
{
int byteCount;
try
{
byteCount = (chatClient.GetStream()).EndRead(ar);
if(byteCount <1)
{
Disconnect();
MessageBox.Show("Disconnected!!");
return;
}
BuildText(recByte,0,byteCount);
if(!firstTime)
{
AsyncCallback GetMsgCallback = new AsyncCallback(GetMsg);
(chatClient.GetStream()).BeginRead(recByte,0,1024,GetMsgCallback,this);
firstTime = false;
}
}
catch(Exception ed)
{
Disconnect();
MessageBox.Show("Exception Occured :"+ed.ToString());
}
}
public void BuildText(byte[] dataByte, int offset, int count)
{
for(int i=offset; i<(count); i++)
{
if (dataByte[i] == 10)
{
Parse(myBuilder.ToString());
myBuilder = new System.Text.StringBuilder();
continue;
}
myBuilder.Append(Convert.ToChar(dataByte[i]));
}
}
private void Parse(string message)
{
string str = message.TrimEnd('\r');
if(str != "")
{
string[] mes = str.Split('|');
int id = Int32.Parse(mes[0]);
switch (id)
{
}
}
}
I'm not sure why the other messages aren't getting through, but it makes it really difficult to talk to people when you can't see what they are saying.
If anyone can help me figure this out, any help would be greatly appreciated.
Thanks in advance,
Paradox
|
|
|
|
|
Paradox22 wrote:
if(!firstTime)
{
AsyncCallback GetMsgCallback = new AsyncCallback(GetMsg);
(chatClient.GetStream()).BeginRead(recByte,0,1024,GetMsgCallback,this);
firstTime = false;
}
It's this firstTime variable - presumably, it will be set to true when you first come into this method, which means that the code inside the if statement will never get called, so the next messages will not be received. I don't think you need this firstTime variable at all, I'm not seeing what it's doing for you here.
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
Hello,
does anyone know if the dialog shown by the ImageEditor (where you can also select Images from your resource-files) in Visual Studio is available as a class somewhere...I would like to invoke it directly without the ImageEditor class used as argument for the EditorAttribute...I tried already to use ImageEditor.EditValue directly (in a method invoked at design-time) but nothing happens.
Thank you
|
|
|
|
|
I have a class:
class DBdata
{
public int id;
public int name;
public int email
blah blah blah
}
This class correlates to a table in the database, as you could probably tell.
I want to show this in Tree View where for example the name is the actually text of the node but the id and email are also encapsulates parts or that data, so that is to say if a drag one node from one tree to the another tree view it will cary its data with it. How can i do this because in a tree view I cant add any object unless it is of type TreeNode.
|
|
|
|
|
Either make the Tag property of each TreeNode in the TreeView point to an instance of DBdata, or create a TreeNode-derived class that exposes it (and then only add instances of the derived node to the tree). The first option is probably sufficient.
|
|
|
|
|
Hello,
I have a DataGridView, with data that is data bound to it. And in one column, I'm trying to data bind a tooltip text with it. Is this possible?
Or should this be done manually, iterating each row and setting the tool tip for that column for each row manually?
Thank you,
Rafferty
|
|
|
|
|
I seem to recall, but am not sure, that when you have a Form.Paint() event,
that it paints its' background and borders, then iterates through all controls issuing their Paint() method.
Now I have some logic that is keying off of the DataGridView.RowPrePaintEvent but I want to make sure that once I did the painting of the rows the very first time, that I no longer go through the long chunky code I have to implement. So my thinking is this:
I overload my Form.Paint method
Form.Paint does a base.Paint();
the base form paint method then calls all the controls
each DataGridView.RowPrePaintEvent is fired and processes correctly.
since it is the first event I also execute the ugly code that is long and bulky
when base.Paint() returns, I can safely say I painted my form the first time and set my state to processed.
Does that sound quite accurate in the sequence of events???
|
|
|
|
|
Hi guys,
I am having a weird problem. I have always had this working and now suddenly after moving to a different computer and reinstalling visual studio 2003.NET; my application doesn't show the tree structure for the FolderBrowserDialog. here is my code for the browse buttons.
private void cmdBrowse1_Click(object sender, System.EventArgs e)
{
TBSrc.Text=GetFolderPath();
}
private string GetFolderPath()
{
string sTemp=string.Empty;
folderBrowserDialog1.ShowNewFolderButton=true;
folderBrowserDialog1.ShowDialog(this);
sTemp=folderBrowserDialog1.SelectedPath;
return sTemp;
}
Please help!!!!
sasa
|
|
|
|
|
Someone mentioned the same issue a few weeks back. IIRC, it was to do with the app running in MTA. Search the forum
|
|
|
|
|
Thank you; you were right, I searched and found the reason and solution.
sasa
|
|
|
|
|
I have a Ipscaner.exe programe which is for scanning the live ip addresses of pcs in a network.I have got the dll file of the programe.Can u pls suggest me how to call the dll from the C#.
sxasxaxaxasxaxasxasxasxaxxasx
|
|
|
|
|
If the DLL which contains the method (function) was written with managed code, then simply add a reference to it in your Visual Studio project, and call the method.
If the DLL is COM-based, create an RCW from the DLL's TLB, and then call into the RCW.
If the DLL is just plain old native code, use PInvoke.
If you have any questions about how to do any of the above, search CP or Google for examples.
|
|
|
|
|
Hello,
The users require a shortcut key to allow them to navigate from one groupbox to the next. I am catching the key press event in the forms base class. The group boxes that will be available for navigation are in an arraylist that is available to the base class. How can I determine which groupbox is currently active? I tried the Focused property, but it always returns false. I have looped through each groupbox's Controls collection, and tested the Focused property of each control, but they all return false as well.
Is there any method or property that I can use to determine the active control? Or will I need to do this manually?
-- modified at 13:01 Monday 7th August, 2006
I am using C#, VS 2003.
|
|
|
|
|
I believe that the static Form.ActiveControl property is what you need.
|
|
|
|
|
Thank you, that gets the job done. BTW it is an instance, not static, property.
No eternal reward will forgive us now for wasting the dawn.
- Jim Morrison
|
|
|
|
|
dennisd45 wrote: BTW it is an instance, not static, property.
Doh! Of course, it doesn't make sense for it to be static. Sorry about that.
|
|
|
|