|
Mustafa Ismail Mustafa wrote: Also, aren't arrays pushed onto the stack whilst the other dynamic datastructures get pushed onto the heap?
Arrays are reference types. So goes to heap not stack. Check this[^]
Mustafa Ismail Mustafa wrote: I can't find any sources for or against this argument,
Look into List<T> class using reflector. You will come to know.
|
|
|
|
|
Excellent. Thank you indeed, it was a pleasure learning all of this
Kudos Navaneeth.
|
|
|
|
|
I am delighted. Thanks Mustafa.
|
|
|
|
|
Where ever you have read it its correct that strings are immutable and a new instance is created.
And when you append add or do any other operation a new instance is created so always be precise with your string operations.
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
|
Good day. I would like to create a C# program that run full screen with looped video (avi/mpeg) as background.
Can anyone give me some hints on how to start as I have no idea which MSDN functions I should use?
Thank you.
|
|
|
|
|
Can anyone give me some hints on how to start as I have no idea which MSDN functions I should use
You must know that MSDN is not a framework whose functions you want to know. And if you want piece of code then you wont get it here. Try google, you will find many articles on it.
For full screen set the mode of form to full screen.
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
Geez, ease up. He never said MSDN was a framework--he was talking about finding functions on MSDN, of which there are a million. Also, MSDN has lots of code samples, so I don't know what you're talking about.
Edit: My bad, re: code you said "here"; I read "there".
“Time and space can be a bitch.”
–Gushie, Quantum Leap
{o,o}.oO( Looking for a great RSS reader? Try FeedBeast! )
|)””’) Built with home-grown CodeProject components!
-”-”-
|
|
|
|
|
As it has been already said, try to google out for the code...
And if you dont know how to google it...This[^] is an example...
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Thank you for reply. But I still unmanage to find a method to play video (avi) on the background of window form... Anyone have solution?
|
|
|
|
|
you will need some player component (for eg. Media Player) to do this
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I had to buid the programs but when i run it which had to occupy butffer. So that i need to help to resolve this problem.
Evething idea please send fllowing Address mail: medop82@yahoo.com
Thanks you very much!
the class of me
public class CatalogueArea
{
#region Define
private System.Data.SqlClient.SqlConnection con = Medop.Define.Global.Static.ClassStatic.con;
private string[] _ArrayReturn = new string[] { Medop.Define.Global.Static.ClassStatic.DefaultEmpty, Medop.Define.Global.Static.ClassStatic.DefaultEmpty, Medop.Define.Global.Static.ClassStatic.DefaultEmpty };
private System.Data.DataSet _DsNull = null;
private string _CodeReturn;
#endregion Define
#region Contruct
public CatalogueArea()
{
}
#endregion Contruct
#region Public
public int VoidCheckExit(string input, string NameFile, string NameTable)
{
try
{
string sql;
if (con.State != ConnectionState.Open) con.Open();
sql = "SELECT * from " + NameTable + " where 1=1 and " + NameFile + "=" + "'" + input + "' ";
SqlCommand cm = new SqlCommand();
SqlDataAdapter da = new SqlDataAdapter();
DataSet mDataset = new DataSet();
cm = new SqlCommand(sql, con);
cm.ExecuteNonQuery();
da = new SqlDataAdapter(sql, con);
da.Fill(mDataset, Define.Global.Static.ClassStatic.NameTable);
da.Dispose();this.con.Close();
if (mDataset.Tables[Medop.Define.Global.Static.ClassStatic.NameTable].Rows.Count != 0)
return 0;
else
return 1;
}
catch
{
return 10;
}
}
public DataSet VoidGetNoneDataset()
{
try
{
string sql;
if (con.State != ConnectionState.Open) con.Open();
sql = "SELECT 0 AS STT, CODE_AREA, NAME_AREA, NOTE FROM dbo.AREA WHERE (1 <>1)";
SqlCommand cm = new SqlCommand();
SqlDataAdapter da = new SqlDataAdapter();
DataSet mDataset = new DataSet();
cm = new SqlCommand(sql, con);
cm.ExecuteNonQuery();
da = new SqlDataAdapter(sql, con);
da.Fill(mDataset, Define.Global.Static.ClassStatic.NameTable);
da.Dispose();this.con.Close();
return mDataset;
}
catch
{
return _DsNull;
}
}
public int VoidInsert(string CODE_AREA, string NAME_AREA, string NOTE)
{
try
{
if (VoidGetDataset(CODE_AREA, true).Tables[Medop.Define.Global.Static.ClassStatic.NameTable].Rows.Count != 0)
{
return 0;
}
string sql = Medop.Define.Global.Static.ClassStatic.DefaultEmpty;
sql = " set dateformat dmy; INSERT INTO dbo.AREA (";
sql += "CODE_AREA,";
sql += "NAME_AREA,";
sql += "NOTE";
sql += ") values (";
sql += "N'" + CODE_AREA + "'";
sql += ",N'" + NAME_AREA + "'";
sql += ",N'" + NOTE + "'";
sql += ")";
if (con.State != ConnectionState.Open) con.Open();
SqlCommand vCommand = new SqlCommand(sql, con);
vCommand.ExecuteNonQuery();
vCommand.Dispose();
_CodeReturn = CODE_AREA;
return 1;
}
catch
{
return 10;
}
}
public int VoidUpdate(string CODE_AREA, string NAME_AREA, string NOTE)
{
try
{
SqlCommand vCommand = new SqlCommand();
string sql = Medop.Define.Global.Static.ClassStatic.DefaultEmpty;
sql = "set dateformat dmy; update dbo.AREA set ";
sql += "NAME_AREA=N'" + NAME_AREA.Trim() + "'";
sql += " ,NOTE=N'" + NOTE.Trim() + "'";
sql += " WHERE CODE_AREA=N'" + CODE_AREA.Trim() + "'";
if (con.State != ConnectionState.Open) con.Open();
vCommand = new SqlCommand(sql, con);
vCommand.ExecuteNonQuery();
vCommand.Dispose();
_CodeReturn = CODE_AREA;
return 1;
}
catch
{
return 10;
}
}
public int VoidDelete(string CODE_AREA)
{
try
{
string sql = Medop.Define.Global.Static.ClassStatic.DefaultEmpty;
sql = "delete from dbo.AREA where CODE_AREA=N'" + CODE_AREA.Trim() + "'";
if (con.State != ConnectionState.Open) con.Open();
SqlCommand vCommand = con.CreateCommand();
vCommand.CommandText = sql;
vCommand.ExecuteNonQuery();
vCommand.Dispose();
return 1;
}
catch
{
return 10;
}
}
#endregion Public
#region Private
public DataSet VoidGetDataset(string _Input, bool CodeorAll)
{
try
{
string sql;
if (con.State != ConnectionState.Open) con.Open();
if (CodeorAll)
{
if (_Input.Trim().Equals(Medop.Define.Global.Static.ClassStatic.DefaultEmpty))
{
sql = "SELECT 0 AS STT, CODE_AREA, NAME_AREA, NOTE FROM dbo.AREA where 1=1 order by CODE_AREA,NAME_AREA,NOTE";
}
else
{
sql = "SELECT 0 AS STT, CODE_AREA, NAME_AREA, NOTE FROM dbo.AREA where 1=1 and CODE_AREA=N'" + Medop.Dispose.Conveniently.Conveniently.Replate(_Input.Trim()) + "' order by CODE_AREA,NAME_AREA,NOTE";
}
}
else
{
if (_Input.Trim().Equals(Medop.Define.Global.Static.ClassStatic.DefaultEmpty))
{
sql = "SELECT 0 AS STT, CODE_AREA, NAME_AREA, NOTE FROM dbo.AREA where 1=1 order by CODE_AREA,NAME_AREA,NOTE";
}
else
{
sql = "SELECT 0 AS STT, CODE_AREA, NAME_AREA, NOTE FROM dbo.AREA where 1=1 and CODE_AREA like N'%" + Medop.Dispose.Conveniently.Conveniently.Replate(_Input.Trim()) + "%' or NAME_AREA like N'%" + Medop.Dispose.Conveniently.Conveniently.Replate(_Input.Trim()) + "%' order by CODE_AREA,NAME_AREA,NOTE";
}
}
SqlCommand cm = new SqlCommand();
SqlDataAdapter da = new SqlDataAdapter();
DataSet mDataset = new DataSet();
cm = new SqlCommand(sql, con);
cm.ExecuteNonQuery();
da = new SqlDataAdapter(sql, con);
da.Fill(mDataset, Define.Global.Static.ClassStatic.NameTable);
da.Dispose();this.con.Close();
if (mDataset.Tables[Define.Global.Static.ClassStatic.NameTable].Rows.Count != 0)
{
_ArrayReturn[0] = mDataset.Tables[Define.Global.Static.ClassStatic.NameTable].Rows[0][Medop.Define.FieldInDatabase.StaticCatalogue.CODE_AREA].ToString().Trim();
_ArrayReturn[1] = mDataset.Tables[Define.Global.Static.ClassStatic.NameTable].Rows[0][Medop.Define.FieldInDatabase.StaticCatalogue.NAME_AREA].ToString().Trim();
_ArrayReturn[2] = mDataset.Tables[Define.Global.Static.ClassStatic.NameTable].Rows[0][Medop.Define.FieldInDatabase.StaticCatalogue.NOTE].ToString().Trim();
}
return Medop.Dispose.Conveniently.Conveniently.MakeStandardDataSet(mDataset);
}
catch
{
return null;
}
}
#endregion Private
#region Property
public string[] ArrayReturn
{
get { return _ArrayReturn; }
}
public string CodeReturn
{
get { return _CodeReturn; }
}
#endregion
}
đ
|
|
|
|
|
|
YAWT :
Yet Another WTF Topic !
|
|
|
|
|
medop82 wrote: Subject: Help me resolve problem!
Please try to write a subject that has any relevance for the post. Almost everyone posting in every programming forum that exist in the entire world wants help to resolve a problem, so your subject line is completely useless for distinguishing this thread from any other.
medop82 wrote: I had to buid the programs but when i run it which had to occupy butffer.
I don't understand what you are trying to say. I think that you have compiled the program, but when running it something happened which has something to do with some kind of buffer. I have no idea what you are trying to do, or why the buffer would be a problem.
medop82 wrote: So that i need to help to resolve this problem.
Then you have to explain what you are trying to do, what happens, and why that is a problem. Post the relevant code, not your entire solution.
medop82 wrote: please send fllowing Address mail: medop82@yahoo.com
A forum doesn't work that way. You get the response in the forum or not at all.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Guffa wrote: A forum doesn't work that way. You get the response in the forum or not at all.
Besides, CP will notify you by email when someone responds to your post, which is quite handy!
“Time and space can be a bitch.”
–Gushie, Quantum Leap
{o,o}.oO( Looking for a great RSS reader? Try FeedBeast! )
|)””’) Built with home-grown CodeProject components!
-”-”-
|
|
|
|
|
Hi friends
I have a structure shown below. I want to convert below structure into bytes or chars array. I like to sent converted chars or bytes to remote computer using socket communication.
public struct _some_data
{
int no;
char []name = new char[15];
int total;
double percent;
}
thanks in advance
-RisKhan-
|
|
|
|
|
I haven't tried this myself but this[^] may help.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
You can serialize it.
[Serializable]
public struct SomeStruct
{
public int no;
public char[] name;
public int total;
public double percent;
public SomeStruct(int no,int total,double percent){
this.no = no;
this.total = total;
this.percent = percent;
name = new char[15];
}
} Use BinaryFormatter to serialize this structure.
SomeStruct structInstance = new SomeStruct(10,10,100);
BinaryFormatter formatter = new BinaryFormatter();
byte[] b;
using(MemoryStream stream = new MemoryStream())
{
formatter.Serialize(stream, structInstance);
b = stream.GetBuffer();
}
|
|
|
|
|
Here is the solution : Fast and Easy :
You have to serialize (binary) your struct in a MemoryStream object. then you get the byte array from your memory stream
public byte [] GetBytes (_some_data d)
{
BinaryFormatter bf = new BinaryFormatter();
MemoryStream ms = new MemoryStream();
bf.Serialize(ms, s);
byte [] b = ms.ToArray();
return b;
}
you have to mark you struct as serializable add [Serializabe]
and to use those namespaces
System.Runtime.Serialization;
System.Runtime.Serialization.Formatters.Binary;
|
|
|
|
|
thanks friends, i can got three solution, it will try all and take the best.
-RisKhan-
|
|
|
|
|
you are welcome
|
|
|
|
|
hi
how to add winform in workflow ??!??
|
|
|
|
|
Please Don't post repeated question with subject
Cheers!!
Brij
|
|
|
|
|
You could have used same post to ask two (one liner) questions.
In a way that would have helped you and the other members.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|