|
what is compile time polymorphism and run time polymorphism.give 1 line description
|
|
|
|
|
Do your own homework. Buy a book. Learn to google.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
|
WTF !
|
|
|
|
|
Ram_Bytes wrote: give 1 line description
No. Not until you buy me some flowers and say please. I don't put out on a first date.
|
|
|
|
|
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
This is ridiculous.
You posted the same question yesterday and people gave their time to reply, you are shameless enough to post the same question again.
Did you even read what all answers were given you.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
This guy is only asking homework questions. Ignore.
Blog link to be reinstated at a later date.
|
|
|
|
|
Ram_Bytes wrote: give 1 line description
Ahem... I liked The Matrix too.
Wouldn't it be nice to plug a cable in the back of your head and after 3 seconds you go... 'I know C++'
Study if you want to learn.
|
|
|
|
|
Hi all,
I want to restrict the Tree Node label length,when the label is being edited.
How can i accomplish this.
Thanks in Advance,
San
|
|
|
|
|
Create a dialog for editing the label and set the restrictions in the dialog for how the label can be changed. Disable the native label editing in the tree node and handle an event (possibly click) to show the dialog.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
Here is mycode:
<br />
private void NullAndRelease(object runtimeObject)<br />
{<br />
try<br />
{<br />
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(runtimeObject);<br />
}<br />
catch {}<br />
finally<br />
{ <br />
runtimeObject = null; <br />
}<br />
}<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
Microsoft.Office.Interop.Excel.Application ExcelApp = new Microsoft.Office.Interop.Excel.Application();<br />
object NullParam = System.Reflection.Missing.Value;<br />
Workbook Book = ExcelApp.Workbooks.Open(FileName, 0, true, NullParam, NullParam, NullParam,<br />
true, NullParam, NullParam, false, false, NullParam, false, true, NullParam);<br />
Worksheet Sheet = Book.Worksheets[1] as Worksheet;<br />
Range UsedRange = Sheet.UsedRange;<br />
<br />
Range Cell = null;<br />
int RowCount = UsedRange.Rows.Count;<br />
for (int i = 2; i <= RowCount; i++)<br />
{<br />
Cell = UsedRange.Cells[i, 1] as Microsoft.Office.Interop.Excel.Range;<br />
Cell = UsedRange.Cells[i, 2] as Microsoft.Office.Interop.Excel.Range;<br />
Cell = UsedRange.Cells[i, 3] as Microsoft.Office.Interop.Excel.Range;<br />
Cell = UsedRange.Cells[i, 4] as Microsoft.Office.Interop.Excel.Range;<br />
Cell = UsedRange.Cells[i, 5] as Microsoft.Office.Interop.Excel.Range;<br />
Cell = UsedRange.Cells[i, 6] as Microsoft.Office.Interop.Excel.Range;<br />
NullAndRelease(Cell); <br />
}<br />
NullAndRelease(Cell);<br />
NullAndRelease(UsedRange);<br />
NullAndRelease(Sheet);<br />
if (Book != null)<br />
Book.Close(false, NullParam, false);<br />
NullAndRelease(Book);<br />
ExcelApp.Quit();<br />
NullAndRelease(ExcelApp);<br />
GC.Collect();<br />
GC.WaitForPendingFinalizers(); <br />
}<br />
These code works well.But when I add the following code in the for loop:
<br />
Cell = UsedRange.Cells[i, 7] as Microsoft.Office.Interop.Excel.Range;<br />
The server does not shut down. It seems that I can only read not more than 6 cells.That's why?
|
|
|
|
|
Hi,
I don´t like to use(in some situations) "created object from the toolbox" i like to, if possibly, use code.
To connect to a database i code the dataset, i don´t use the created object from the toolbox.
I download some projects that create the dataset to crystal reports not coding but by the toolbox.
I have coded a dataset/connection to a database and i would like to connect to crystal report using also code!!! not the dataset toolbox
Is there a crystal report sample that created dataset by code? the ones i downloaded use the dataset toolbox.
thanks
nelsonpaixao@yahoo.com.br
|
|
|
|
|
In C++, this would be exteremely easy (I can think of a couple of methods off the top of my head).
Yet... Is there a way in Pure C# to do this?
Just to clarify: I am talking about taking a void* (returned from a function like CoCreateInstance) and accessing a function without going through C# Com Interop. I read somewhere that someone did this by accessing the vtable of the interface pointer though he or she failed to mention how he or she did this.
Thank you in advance.
|
|
|
|
|
List<string[]> salesPeriod = new List<string[]>();<br />
string[] totalPeriodNo = new string[3];<br />
<br />
<br />
totalPeriodNo[0] = "AA";<br />
totalPeriodNo[1] = "0.01";<br />
totalPeriodNo[2] = "0.02";<br />
totalPeriodNo[3] = "0.03";<br />
salesPeriod.Add(totalPeriodNo);<br />
<br />
<br />
totalPeriodNo[0] = "BB";<br />
totalPeriodNo[1] = "0.06";<br />
totalPeriodNo[2] = "0.07";<br />
totalPeriodNo[3] = "0.08";<br />
salesPeriod.Add(totalPeriodNo);<br />
How can I go about editing BB for period 3 from 0.08 to 1.33 ?
|
|
|
|
|
Okay, a List has random-access support so just edit it the same way you would an array.
salesPeriod[1][3] = "1.33";
Hope that helps.
|
|
|
|
|
As you have added the same array to the list twice, you have a list with two reference to the same array. Therefore there is three ways of changing the period:
totalPeriodNo[3] = "1.33";
salesPeriod[0][3] = "1.33";
salesPeriod[1][3] = "1.33";
Either of these will change the item in the array. As the list is just two references to the same array, the change will be visible in both items of the list.
If you want two separate items in the list, you have to create a new array object before populating it with the BB data.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Maybe it was just a typo in your sample, but:-
string[] totalPeriodNo = new string[3];
declares a string array with 3 elements. These elements are indexed as 0, 1 and 2
so, your line:-
totalPeriodNo[3] = "0.03";
will throw an exception.
|
|
|
|
|
/method to convert decimal stored in "nDecimal"
//to two's complement representation, stored in array "bitstring"
private void decimal_to_twoc( )
{
int nDecimal = Convert.ToInt32(decimal_input.Text);
//string numBits = Convert.ToString(decimal_output.Text);
int carry = 1;
int flag = 0;
if (flag==0)
{
for (int i = 0; i < 8; i++)
bitstring[i] = bitstring[i] + 2;
bitstring[nDecimal] = carry;
carry = 0;
if (bitstring[nDecimal] > 1)
{
bitstring[nDecimal] = 0;
carry = 1;
It is givingme a wrong conversion from decimal to two's complement and I can figure out the reason. Any help please?
|
|
|
|
|
What are you trying to do ? Where is bitstring defined ? Obviously, it's not reset in this function, so whatever value it had, 2 is added to every element. I don't see how you remotely are interacting with the decimal, except as an index into an array. So, if your array has 8 elements, as it seems, a number > 8 will just crash it, right ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
This is where I started from, thanks.
.............................................................
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace TwosComplement
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
for (int i = 0; i < 8; i++)
{ bitstring[i] = 0;}
twoc_output.Text = "enter an integer";
decimal_output.Text = "enter a length 8 bitstring";
}
private int[] bitstring = new int[8];
private int nDecimal;
//strings for reading the bitstring in and out
private string instring, outstring;
private string nextbit;
//helper function for flipping bits in the bitstring
private int negate(int x)
{
if (x == 1) return 0;
return 1;
}
//method to convert decimal stored in "nDecimal"
//to two's complement representation, stored in array "bitstring"
private void decimal_to_twoc( )
{
int nDecimal = Convert.ToInt32(decimal_input.Text);
string numBits = Convert.ToString(decimal_output.Text);
int carry = 1;
int flag = 0;
if (flag==0)
{
for (int i = 0; i < 8; i++)
bitstring[i] = bitstring[i] + 2;
bitstring[nDecimal] = carry;
carry = 0;
if (bitstring[nDecimal] > 1)
{
bitstring[nDecimal] = 0;
carry = 1;
}
}
}
|
|
|
|
|
OK, so your first issue is that the code, when it works, will only work once. Because you only reset the array once. Or is it meant to be cumulative ?
Angelinna wrote: private int negate(int x)
{
if (x == 1) return 0;
return 1;
}
Not sure that you call this, but is it really worth writing a function for ? How about just writing this:
return 1 - x;
and 1-x is something you can just code inline instead of making a call, surely ?
I'd have expected you'd need to use the & operator to work out what bits are set in the original number, what you're doing here seems to me to be doomed to fail.
bitstring[nDecimal] = carry;
This will just crash if nDecimal > 7 and won't ever do anything useful.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Ya , not really sure of what am doing. Would like the code to work for both positive and negative integers and should take care of any "out of range" errors.......
Otherwise would appreciate tips or web where I may read more on this.
Thanks.
|
|
|
|
|
|
Christian Graus wrote: reads to me like a two's complement is the same as !x + 1.
Signed numbers are stored as two's complement, so the easiest way to get it is to cast a signed number to an unsigned number:
int negAnswer = -42;<br />
uint twosComplement = (uint)negAnswer;
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|