|
Hi
what we write in c#
int a;
int *p=&a;
|
|
|
|
|
You can use pointers in C#, but only in code blocks marked unsafe. Usually you use references.
As an int is not a reference type, you have to box it as an object to get a reference to it:
int a = 42;<br />
object r = a;
To get the integer value back from the object, you cast it:
int b = (int)r;
Note that boxing is much less efficient than working with the plain value types directly, as an object has to be created to contain the value.
---
b { font-weight: normal; }
|
|
|
|
|
int a;
int *p=&a
Not sure. But think it is unsafe code, As I remember it worked in the old Bell Labs 'C'.
Sorry, I just had to.. No hate here.. Just sort of 'funnin' ya!
|
|
|
|
|
unsafe
{
int a;
int *p = &a;
}
Compile with /unsafe
|
|
|
|
|
Hi im a beginner and in need of some help.
im tryin to create a simple Aplication,in which i am using 2 tetbox.In the edit menu I am using ctrl+c and ctrl+v as shortcut for copy and paste. But
ctrl+c and ctrl+v are not working inside the individual TextBoxes
Please help.
Thanks
Rajmohan
|
|
|
|
|
you don't need to write any code for this ctrl-c ctrl-x and ctrl-v...
|
|
|
|
|
there is shortcut property of textbot use it dear
|
|
|
|
|
actually I gonna write a program in CSS,my Question is,how can I make a list with 4 folders with the same image, and with a subfolder with different image, all in one list?
You30
|
|
|
|
|
I don't think that cascading style sheets is the best tool for writing programs...
What kind of folders and images are you talking about, and what has this to do with inheritance?
---
b { font-weight: normal; }
|
|
|
|
|
Hi im a beginner and in need of some help.
im tryin to create a simple chat program like mIRC.
Could someone just explain the concept of how it flows.
I have an idea but not sure if thats how it is.
I have a server-side app, and a client-side app connecting to the server. does the message the client types just get sent to the server and then the server sends the message to all connected clients? how do i go about creating handles for each client connecting to my server?
Please help.
Thanks
|
|
|
|
|
|
i want to create a insert statement for inserting data in a table. Here the column names are stored in one array and the values are stored in another array. Any idea will be of great help for me.
thanx in advance all ur help
|
|
|
|
|
Create a query with parameters that have the same name as the fields, like:
"insert into aTable (Some, Other) values (@Some, @Other)"
Create a command object with the query, and add parameter objects for the parameters.
Do you have the data type for the fields?
---
b { font-weight: normal; }
|
|
|
|
|
public string[] GenInsertCmd(DataTable table)
{
string inscmd = "insert into " + table.TableName.Trim().ToLower() + " (";
foreach(DataColumn col in table.Columns)
{
inscmd += col.ColumnName + ",";
}
inscmd = inscmd.Substring(0,inscmd.Length - 1) + ") values (";
string[] sqlcmd = new string[table.Rows.Count];
int i = 0;
foreach(DataRow row in table.Rows)
{
sqlcmd[i] = "";
foreach(DataColumn col in table.Columns)
{
switch (col.DataType.Name.Trim().ToLower())
{
case "string":
try
{
sqlcmd[i] += "'" + ((string)row[col]).Trim().Replace("'","\"") + "',";
}
catch
{
sqlcmd[i] += "null,";
}
break;
case "datetime":
try
{
sqlcmd[i] += "'" + ((DateTime)row[col]).ToString("yyyy-MM-dd hh:mm:ss.sss") + "',";
}
catch
{
sqlcmd[i] += "null,";
}
break;
case "boolean":
try
{
sqlcmd[i] += ((bool)row[col] == true ? "1," : "0,");
}
catch
{
sqlcmd[i] += "null,";
}
break;
case "byte[]":
sqlcmd[i] += "null" + ",";
break;
default:
if (row[col].ToString().Trim() == "")
sqlcmd[i] += "null,";
else
sqlcmd[i] += row[col].ToString().Trim() + ",";
break;
}
}
sqlcmd[i] = inscmd + sqlcmd[i].Substring(0,sqlcmd[i].Length - 1) + ")";
i += 1;
}
return sqlcmd;
}
|
|
|
|
|
Ouch. Don't use a try statement to handle the null values, use an if statement instead. Exceptions should not be used for normal program flow.
---
b { font-weight: normal; }
|
|
|
|
|
i'm trying to make a picture box size itself, and zoom the image in it, when the mouse_move event is fired...the size part works....but it doesn't zoom.
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
System.Drawing.Size sz = new Size();
sz.Height=450;
sz.Width=600;
pictureBox1.Focus();
pictureBox1.Size = sz;
}
rzvme
|
|
|
|
|
Did you set the PictureBox.SizeMode property to PictureBoxSizeMode.Zoom ?
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
yup...tried that 2.
could the problem be the fact that i have 8 picturebox controls...very close to each other(there is no space between them))?
rzvme
|
|
|
|
|
rzvme wrote: could the problem be the fact that i have 8 picturebox controls...very close to each other(there is no space between them))?
I don't think this is a problem. Even if the picture boxes overlap each other there should be no problem. Maybe you have to explicitely tell the picture box to redraw (Invalidate, Refresh, Update). Or there is some setting that prevents the image from getting zoomed (MaximumSize or something like this). Debug your app and check how the properties of your picture box change when your event handler is executed.
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
10x for the tip. Now it works, but when the event is fired the picture is zoomed, and the picturebox size is modified , but the only part of the picture visible to me is the top left corner of the picture. What's wrong?
rzvme
|
|
|
|
|
how to pass variables through forms. I wish to make a a window form with a textbox.text from other form in my aplication
|
|
|
|
|
Passing values between forms[^]
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hello
I was wondering : when I use System.Threading and use files, do I have a process switch or will another thread in the program get the remaining time share.
Clint
|
|
|
|
|
I'm not sure if I fully understood the question, but if you're using threads from System.Threading the time the threads are running are automatically scheduled and switched by the windows for you.
|
|
|
|
|
Also, if you're going to be writing a multi threaded app, be sure to make your data thread safe using syncronization objects, or one thread could overwrite your data while you're working with it in another thread.
|
|
|
|