|
You can change this either by turning off autogeneratecolumns for your datagrid, and adding the columns in the IDE via the properties window of the datagrid.
Another option is doing it by code. Datagrid and its columns have properties you can change at runtime. They might need a refresh, I'm not sure.
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
joon vh. wrote: autogeneratecolumns
I should have mentioned I'm using Windows Forms.
joon vh. wrote: Datagrid and its columns have properties you can change at runtime.
I'm sorry if my questions sounds very basic, but can you give me an example?
Cheers,
Vikram.
The cold will freeze our stares
We won't care...
|
|
|
|
|
dataGridView1.AutoGenerateColumns = false; --> this prevents the columns to be made when you set a datasource and bind it. You have to define the columns yourself now, and the easiest way is doing it in Visual Studio.
dataGridView1.Columns["myCol"].Width = 100;
things like that
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
joon vh. wrote: dataGridView1.AutoGenerateColumns = false;
I'm using .NET 1.1, and System.Windows.Forms.DataGrid does not contain an AutoGenerateColumns or Columns property.
Cheers,
Vikram.
The cold will freeze our stares
We won't care...
|
|
|
|
|
darn, I hoped you were using DataGridView, now I don't think I can help you any further.
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
After setting the DataSource, try setting the header yourself.
|
|
|
|
|
I have a Dataset with two table. The first table has 5 columns. The second Table 3 columns.
Now i need to show only the columns 2 and 4 from the first table and 2 from the second table.
And these columns should be shown in the same Datagrid.
Is there any easy way to do this?
I tried to make a new Table.
DataTable dtab = new DataTable("coded");
foreach(DataColumn dc in firsttable.Columns)
{
dtab.Columns.Add(dc);
}
but when i tried that i get an error message that the column is already in another table.
|
|
|
|
|
it might be easier to answer this question if you explained what kind of data is in the two tables and how you want it presented. Give some examples.
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
i am having 2 bitmaps and i need to copy them into the third bitmap, how should i proceed plz help
|
|
|
|
|
Create a Graphics object for the third bitmap and use that to draw the other bitmaps onto it.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi,
i have one object and i want to serialize with XmlSerializer. It is possible to see the field with no data?
EX:
<br />
class kuku<br />
{<br />
int test;<br />
int problem;<br />
}<br />
<br />
class main<br />
{<br />
....<br />
kuku obj=new kuku();<br />
obj.test=10;<br />
XmlSerializer ser=new XmlSerializer(typeof(kuku));<br />
StringWriter writer = new StringWriter(new StringBuilder());<br />
ser.Serialize(writer,obj);<br />
string s=writer.ToString(); <br />
.....<br />
}<br />
<br />
and the s will contain <br />
<br />
<kuku> <br />
<test>10</test><br />
</kuku><br />
<br />
and i want<br />
<br />
<kuku> <br />
<test>10</test><br />
<problem></problem><br />
</kuku><br />
<br />
how can help me???? C# will make me mad!!!!
My brain is in fire
|
|
|
|
|
You will see test=10 and problem=0
class Program
{
static void Main(string[] args)
{
kuku k = new kuku();
k.test = 10;
XmlSerializer xmlSerializer = new XmlSerializer(typeof(kuku));
FileStream fileStream = new FileStream("test.xml", FileMode.Create);
xmlSerializer.Serialize(fileStream, k);
fileStream.Close();
}
}
public class kuku
{
public int test;
public int problem;
}
|
|
|
|
|
What happens, if you explicitely set problem to its default value (0)?
"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
|
|
|
|
|
I used the same code and it didn't generate any problems. I had to make the variables public though. Maybe you should try to fiddle around with their modifiers.
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
Hi!
I am using C# 2005 for my project, i am facing problem with refreshing contents of form. here is the scenario:
i have a DateTimePicker control on form, i want to use it like clock,
i.e. i created a thread which runs a timer, after 1 second im assignning the current time to the DateTimePicker.
Now the control should show the new value but it does'nt refresh.
i tried refresh(), validate() functions but no result...i even called the form_Load function but stil it displays old contents.
I am facing similar problems in some other forms too...
Please tell me wat im missing, do help me in ths regard. Thanks,
Regards,
Affan Toor
|
|
|
|
|
you don't need any special function.
I tried this, and it works:
private void timer1_Tick(object sender, EventArgs e)
{
dateTimePicker1.Value = DateTime.Now;
}
Make sure you set the timer interval to anything smaller than 1000 and that it is enabled (standard it is disabled)
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
joon vh.
THANKS ALOT FOR YOUR REPLY, IT REALLY HELPED ME ALOT IN SOLVING MY PROBLEM.
Thanks again, im looking forward for ur help in future too.
Regards,
Affan Toor
|
|
|
|
|
You should never access a control (in your case the datetimepicker) from a thread other the one that created the control cause this cn cause unexpected behaviour e.g. freezing your app. For more information on this topic and how to correctly access controls from other threads take a look at this article What's up with BeginInvoke?[^]
In the special case of your datetimepicker, the simplest solution would be using a plain windows timer (the one from the forms namespace) since it is designed for a single-threaded environment where UI threads are used to perform processing.
"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
|
|
|
|
|
Stefan Troschuetz!
THANKS, ALOT FOR YOUR REPLY, IT REALLY HELPED ME ALOT IN SOLVING MY PROBLEM.
Thanks again, im looking forward for ur help in future too.
Regards,
Affan Toor
|
|
|
|
|
My pleasure
"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,
Why you are using from datetimepicher?
you can use from javascript. it is very easy.
use this:
<span id="Time"></span>
<script language="javascript" type="text/javascript">
function setPcTime()
{
var myDate = new Date();
document.getElementById('Time').innerHTML = myDate.getHours()+':'+fix(myDate.getMinutes())+':'+fix(myDate.getSeconds());
setTimeout('setPcTime()',1000);
}
setPcTime();
function fix(timefix)
{
if(timefix < 10)return "0"+timefix;
else return timefix;
}
</script>
We Can Do Anything, If We Want It
|
|
|
|
|
Hi everyone.
Please help me.
Did anyone see the component like in Microsoft Project for task indicating?
|
|
|
|
|
|
For example you have project and 4 tasks for finishing this project.
I need a component for visualizing this.
In microsoft Project it looks like a ruler with dates above, and every task is shown there like a line.
For example 1 Task last since 13 March to 23 March, it will be shown first,
The next task since 24 march to 1 april and etc.
And after the fourth task you will see on the rule how much every task takes time, and when your project will be finished.
I think that it is more understood able. I will try to find some examples of this indicators.
|
|
|
|
|
It's called a Gantt Chart. Lots of graph packages allow you to create them. You may want to look at something like Dundas Chart.
Deja View - the feeling that you've seen this post before.
|
|
|
|