|
To define recursion, we must first define recursion!!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
pjd, did you figure out how to do this? It looks like you can do it by first assigning it to null:
Function f = null;
f = delegate() { f(); }
|
|
|
|
|
Judah,
thanks I've filed that away for future reference - can't recall the context in which I wanted to do it now - probably a predicate method.
|
|
|
|
|
This sounds like a C++ question. Are you sure you're in the right forum?
|
|
|
|
|
I am using a commercial grid to display my data. I don't have any problem to display the whole table to the grid. For instance, the following code displays a whole table to the grid.
<br />
grid1.SetDataBinding(table1BindingSource);<br />
Now, I only want to display the FirstName and the LastName
I have the following in my form
table1BindingSource and db1DataSet
From db1DataSet, I can see the following by intellicense; my table names Tabl1
from intellicense I can see
Table1.FirstNameColumn and Table1.LastNameColumn;
My question, how can I use table1BindingSource and db1DataSet to display only the firstname and the lastname rather than the whole table?
|
|
|
|
|
You could use the Query Builder. Assuming you are using C# Express Edition, this "in-built" help page from the C# help file that installs with the C# express edition will show you how. There are also related help pages you might like to read! There are other ways to achieve the desired result but for a novice, this might be the easiest way.
ms-help://MS.VSExpressCC.v80/MS.NETFramework.v20.en/dv_vdt01/html/815a30ce-6fb1-4611-bf43-bedd2020c443.htm
Although you are wanting to program in C#, the question is about database. Try posting database questions in the correct forum.
modified 1-Aug-19 21:02pm.
|
|
|
|
|
Try this link.
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hey guys
i have a c# project and ive added a project installer...
is there any way i can install some fonts to in the windows font directory as the application gets installed?
many thanks
Will
|
|
|
|
|
Checkout the help of the Visual Studios...
It is all in there ...
Don't you also love the code?
|
|
|
|
|
ive had a dig around and cant much :S
can u point me in the right direction?
|
|
|
|
|
When you have created a new setup project in vs2005, you go to the 'File System' right click on 'File System on Target Machine', 'Add Special Folder', 'Fonts Folder'.
And then you just add in the Fonts folder the right files...
Just of topic... I have helped you could you help me? I want to finish my work (General Discussion - Cards?).
Don't you also love the code?
|
|
|
|
|
thanks dude! spot on!!
|
|
|
|
|
hi every one,
well I have this little problem here. I'm getting a nullreferenceException when I try to access the value of a DataGridViewComboBox column. I have correctly bounded the column and its also showing the values of that table too. The name of the column is "AttendanceComboBoxColumn". now I just wanna know how to get the value selected in this comboBox.
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
//MessageBox.Show("att: " + dataGridView1["AttendanceComboBoxColumn", i].Value.ToString() + "\n empid: " + dataGridView1["empIDDataGridViewTextBoxColumn", i].Value.ToString()+"\nDate: "+selected_date.ToString());
//MessageBox.Show("att: " + dataGridView1["AttendanceComboBoxColumn", i].Value.ToString() + "\n empid: " + dataGridView1["empIDDataGridViewTextBoxColumn", i].Value.ToString());
//MessageBox.Show("att: " + dataGridView1["AttendanceComboBoxColumn", i].Value.ToString() );// null ref
//MessageBox.Show("att: " + dataGridView1["empIDDataGridViewTextBoxColumn", i].Value.ToString()); // ok
//sqlUpdateCommandAttendance.Parameters["@AttendanceID"].Value = Convert.ToDecimal(dataGridView1["AttendanceComboBoxColumn", i].Value);
int c = AttendanceComboBoxColumn.DisplayIndex;
MessageBox.Show(dataGridView1[c, i].Value.ToString());
sqlUpdateCommandAttendance.Parameters["@AttendanceID"].Value = Convert.ToDecimal(dataGridView1[c,i].Value);
sqlUpdateCommandAttendance.Parameters["@original_empid"].Value = Convert.ToDecimal(dataGridView1["empIDDataGridViewTextBoxColumn", i].Value);
sqlUpdateCommandAttendance.Parameters["@original_attendDate"].Value = selected_date;
count+=sqlUpdateCommandAttendance.ExecuteNonQuery();
}
thanks in advance
Rocky
|
|
|
|
|
how can I call a *.exe file from whithin the c# code
Dad
|
|
|
|
|
here u go.
Process p = new Process();
p.StartInfo=new ProcessStartInfo("C:\\CleanMyPCOnStartUp.exe");
p.Start();
|
|
|
|
|
if u want to invoke methods / load forms in a particular exe u can use reflection!
|
|
|
|
|
Is there a way to add lets say "Australia", "Canada", "US" to a combobox dropdown and also set a value such as '5','3','2'?
Visually we'll be able to see the country names...however the numbers above are associated with each country.
|
|
|
|
|
i don't think you can manually set a value to a comboBox item. You can however get the selectedIndex for that item that is chosen.
ex:
comboBox1.Items.Add("US");
comboBox1.Items.Add("CA");
string value = comboBox1.SelectedIndex.ToString();
int value = comboBox1.SelectedIndex;
So if US is selected it will store "0" in the variable "value". If CA is selected it would store "1" etc. Let me know if this helps you.
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Hi,
instead of adding just strings you could add objects holding every info you need:
public struct CountryWithid {
public string Country;
public int Id;
public CountryWithid(string country, int id) {
this.Country = country;
this.Id = id;
}
public override string ToString() {
return this.Country;
}
}
comboBox.Items.Add(new CountryWithId("US", 8));
comboBox.Items.Add(new CountryWithId("Canada", 3));
int selectedid = ((CountryWithId)comboBox.SelectedItem).Id;
Robert
|
|
|
|
|
Extendind on Robert's answer, I have a generic ComboBoxItem class that contains four properties and a method:
int Id - ID of the item
Guid Guid - another ID in Guid form
string Text - text to display
object Tag - any object you would like to assign
string ToString() - simply returns the Text property
And I use that class to add objects to ComboBox es when I have your need.
|
|
|
|
|
how can i receive and send a call through TAPI. can i any one have idea how to use to TAPI and how to connect modem for these typr of application.
Thanks and best Regards.
Zahid kareem
|
|
|
|
|
Hi,
I'm new to C#.
What i have done so far is a simple windows application from which
users input data.
These data is then to be inserted in a pdf file.
Some of the words in this PDF file are distinct so when i search the file
and stumbles on one of this distinct word, i replace it with a user inputted
word.
Also i want to make a copy of the pdf file so i don't screw up the original.
Any suggestions or alternatively solutions?
No need to give full solutions, then i won't
learn anything
Thanks, Daniel from Sweden
|
|
|
|
|
hi there,
i use TAPI to control modem,now i can dial or hang up but i dont know how to send data over a connected line,what should i do?
thanks
|
|
|
|
|
Hello,
I wrote a native C++ dll.
One of the functions it exports receives a string (LPCSTR to be exact), and keeps this string in order to use it later.
When my C# app simply sends a string to the dll, the GC is collecting it as soon as the function returns.
Problem is, I need that string in other functions.
So I've tried using GCHandle like so:
Global stuff:
string s = "MyVeryImportantString";
GCHandle gch; Inside a C# function:
gch = GCHandle.Alloc(s, GCHandleType.Pinned);
nativeDllFunction(GCHandle.ToIntPtr(gch)); Later on I free the GCHandle of course.
That didn't work, but that's probably because I'm doing something wrong, and it probably has a solution...
That's not why I'm writing right now...
I'm here to ask your opinions about my workaround...
Inside my native dll, I wrote a function to allocate new memory for the string, using malloc .
This way I'm not holding a pointer to the string the GC is collecting, but a pointer to a copy I made.
Doing so could help future mistakes with managed assemblies which use this dll.
Moreover, it saves me the need to worry, and the time to write a proper GCHandle code.
As I'm new to dll programming in C++, I don't really know fashionable methods of doing stuff. Is it bad to use the malloc function inside of my dll?
Is it better to use the GCHandle method instead?
Thanks in advance,
Shy.
|
|
|
|
|
Hi,
in order to prevent the gc from deleting or moving an object, you need a GCHandle AND pinning,
as in the following code snippet:
Stream stream=type.Assembly.GetManifestResourceStream(resourceName);
int len=(int)stream.Length;
byte[] buf=new byte[len];
stream.Read(buf, 0, len);
GCHandle handle=GCHandle.Alloc(buf);
IntPtr ptr=Marshal.UnsafeAddrOfPinnedArrayElement(buf, 0);
int res=sndPlaySound(ptr, 4);
handle.Free();
You can postpone the last line (until the unmanaged code no longer uses the pointer),
but you should execute it eventually, otherwise the memory situation will deteriorate.
Luc Pattyn
|
|
|
|