|
It is not working
it is saying "cannot implecitly convert type decimal to int. An explicit conversion exists"
|
|
|
|
|
have you tried Convert.ToInt32 ?
|
|
|
|
|
Thanks that worked
but i didn't know why (int)decimal is not working.
I thought it should work.
best regards
|
|
|
|
|
decimal d = 5;
int i = (int)d;
|
|
|
|
|
quiteSmart wrote: but i didn't know why (int)decimal is not working.
Without seeing the actual line of code you are using, watch your brackets. Especially if you are doing a calculation and then putting the result into an int. You might be casting one of the operands rather than the result (which might still be considered a decimal).
Or there might be another implicit cast going on that you are missing.
|
|
|
|
|
Convert.ToInt32(decimal)
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
int i = (int)mydecimal;
Be aware that this will truncate (round down) so 1.9999 will become 1 not 2. Use Math.Round for actual rounding.
|
|
|
|
|
When one flash file is played in which one or two colors.
and then if a multi colored file is played some color are not coming properly.
ie when the first file is played, it sets some color pallets, due to which it happens.
how to resolve the issue.
Ravi
|
|
|
|
|
Hi,
I am facing a problem while accessing a C++ dll from C# code.
Following is my C++ structure I am using...
typedef struct
{
LONG lPaBitNr;
UCHAR szPaAbr[8];
} AudioUnit_T_DataType;
and corresponding structure I am using in Dot Net is:
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct AudioUnit_T_DataType
{
public int paBitNr;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=8)]
public String paAbr;
}
and following is my declaration of the function of C++ dll.
[DllImport("MyLib.dll", EntryPoint = "MyFunc")]
public static extern int MyFunc(
[MarshalAs(UnmanagedType.AsAny)]
object key,
[MarshalAs(UnmanagedType.AsAny),In, Out]
object data,
int size
);
size is the respective size of the structure (no of bytes to copy in data object)
When I call the MyFunc function with object data as AudioUnit_T_DataType structure,, i got all the data but I always loose the last character (8th) in the String paAbr.
i.e. suppose, the value of szPaAbr[8] was "abcdefgh"
then, after the call of MyFunc function, i got "abcdefg" value.. 'h' is lost (might be it is replaced by null character...)
What should I do to overcome this issue.
I dont want to change the lenght of array from 8 to 9.
Any help is appreciable.
|
|
|
|
|
Even though I'm not at a PC with .NET installed, I can think of 2 possible solutions:
System.Runtime.InteropServices.Marshal.PtrToStringAnsi()
or
CharSet = CharSet.Unicode
|
|
|
|
|
thanks for the quick response.
But both the solutions will not work,, as on C++ side, we donot have null terminated string,, we have array of 8 characters. and on C# side, we want to get that in a string.
Also, the Unicode solution is not working.
|
|
|
|
|
I want to have DateTime in the "YYYY/MM/DD hh:mm:ss:ff" format. Also, it should be of type DateTime only, no string.
Thanks in advance
Praveen Raghuvanshi
Software Engineer
|
|
|
|
|
praveen raghuvanshi wrote: I want to have DateTime in the "YYYY/MM/DD hh:mm:ss:ff" format. Also, it should be of type DateTime only, no string.
OK - this is what you have got with DateTime already. The DateTime class is a wrapper around an internal representation of the date/time. The methods for displaying date and time are there for your convenience.
Yes, when you print it out it will be using the ToString() method, but this is just to cast it into a format for you to use/print out. It does not change the internal representation at all.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thanks............
There was a problem for MM(Month), MM(minutes). I rectified it.
Praveen Raghuvanshi
Software Engineer,
Wins Infotek Pvt. LTd.
Technopark, Trivandrum
India.
|
|
|
|
|
hi everybody,
i am new to c#.
can anybody tell me how to insert text then image again some text then image and so on in word file.
e.g.
some text
image
some text
image
some text
image
some text
image
thanks in advance
praveen
|
|
|
|
|
|
Insert into a MS word file like test.doc.
|
|
|
|
|
Hello,
You can use Ms word com object to do this...
Try to reach the diamond now
nishu
|
|
|
|
|
|
I have tried times but failed. Thanks!
The c++ file b.dll:
//////////////////////////////////
extern "C" __declspec(dllexport)void F();
void F()
{
cout<<"sssssss"<<endl;
}
/////////////////////////////////////
The c# file:
////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace console
{
class Program
{
[DllImport("b.dll", EntryPoint = "F", CharSet = CharSet.Auto, CallingConvention= CallingConvention.StdCall)]
static extern void F();
static void Main(string[] args)
{
F();
}
}
}
-- modified at 6:31 Friday 22nd December, 2006
|
|
|
|
|
Can you explain your real issue??
|
|
|
|
|
I want to call a function F() which includes "cout". The function F() is in a dll file created by vc++6.0.
|
|
|
|
|
Hello,
I am facing a problem in updation of data to dBaseIII database.
I have to append two dBaseIII databases and insert to third database(which all the table structures are same).
I have merged two datasets and tried to update the third database by using ODBCDataAdapter, I was able to see that the two datasets are merged in debugging, but when it was updated by the command ODBCDataAdapter.Update(dsDataset); the new records are not reflecting the physical dBaseIII database.
I was able to select the data from the database, but not able to insert new data through C# program.
The following is the code I have tried! Can any one help me to resolve this problem.
adSTOERUNG = new System.Data.Odbc.OdbcDataAdapter("SELECT * FROM xyzTable",cnnST );
System.Data.Odbc.OdbcCommandBuilder builder = new System.Data.Odbc.OdbcCommandBuilder(adSTOERUNG);
adSTOERUNG.Fill(DSMain,"xyzTable");
DSMain.Merge(DS2Insert.Tables[0]);
adSTOERUNG.Update(DSMain.Tables[0]);
The following ODBC driver I have used for connection.
CollatingSequence=ASCII;SafeTransactions=0;Threads=3;Statistics=0;MaxScanRows=8;DefaultDir=c:\xyz;FILEDSN=c:\xyz\xyztable.dbf.dsn;index=code; DriverId=21; UserCommitSync=Yes;FIL=dBase III;PageTimeout=0;Driver={Microsoft dBase Driver (*.dbf)};MaxBufferSize=10000;UID=admin"
Regards,
Kishore.
|
|
|
|
|
can anybody give me a tutorial on using the progress control bar.
thnaks very much
|
|
|
|
|
The following code can help
drag and drop on form, adjust the size as per your requirements.
private System.Windows.Forms.ProgressBar progressBar1;
this.progressBar1 = new System.Windows.Forms.ProgressBar();
progressBar1.Maximum = 100;
progressBar1.Minimum = 0;
progressBar1.Step = 100 /10;
|
|
|
|