|
Pardon my stupidity on this one:
I need to iterate through a dataset that contains one table w/ one row. Essentially I have 5 fields within the table, and each field has to be output to a label or text box. How do I go about doing this?
Ken
|
|
|
|
|
//get the first table in the dataset, first row (if you only have 1 row), get
//the data by fieldName
textBox1.Text = dataSet.Tables[0].Rows[0]["fieldName"].ToString();
textBox2.Text = dataSet.Tables[0].Rows[0]["otherField"].ToString();
I find it easier to use a DataRow...
DataRow row = dataSet.Tables[0].Rows[0];
textBox1.Text = row["fieldName"].ToString();
textBox2.Text = row["otherField"].ToString();
You can also use numerics in the field if the field names are not constant...
textBox1.Text = row[0].ToString();
textBox2.Text = row[1].ToString();
|
|
|
|
|
although its faster to
SqlDataAdapter myAdapter = MySqlCommand.ExecuteReader();
object[] myArrayOfColumns = myAdapter.GetValues();
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
I need a way to create an activeX at runtime, with nothing more than a CLSID. To put it a different way, I have to be able to create an activeX control without linking to its tlb, similiar to how the ActiveX Control Test Container works.
I used to do this in MFC with the CWnd::CreateControl() function. Is there some C# equivalent to this?
Thanks,
Aaron Stibich
|
|
|
|
|
Do it the same way as you would create a normal WinForms control:
Button button=new Button();
this.Controls.Add(button);
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Wouldn't that require that I've imported the type information for my control (ie. You cannot new a "Button" without having imported the type information for Button)? I need to create and connect to the activeX via late binding methods only.
Aaron
|
|
|
|
|
You can do:
Type type=Type.GetType(classname,false,false);
object control= Activator.CreateInstance(type);
...
But I'd be interested to know if you have to use aximp.exe on the control to create a .NET control wrapper before you can put it on a .NET form.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
I am working on an application which will have the same menu and tool bar in every form.
Does this mean that I should design a 'template' form which has only the menu and tool bar.
Then, each new form ( including the main form ) will inherit this template form?
|
|
|
|
|
Yes, this is one way to do it.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
|
Hi all,
is there a way to open MS Office documents (word documents, excel spreadsheets, powerpoint presentations) and acrobat PDF files within a Windows Forms application? Is there an ActiveX component or something similar to achieve this? Thanks for any clues in advance!
Rado
|
|
|
|
|
iSEDQuickPDF is 60.00. Load the word 9.0 library, excel 9.0 library
also www.planetpdf.com has a lot but ised is cheap and easy to use
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Ista wrote:
iSEDQuickPDF is 60.00
Well, I am not interested in manipulating or generating PDF files, I just want to view them in my application and needed a clue, something where to start and what to look for. But anyway thanks a lot for the info, iSEDQuickPDF looks good and I may use it in future.
Rado
|
|
|
|
|
Okay so I get back monday after a power flicker. I had to rebuild my solution with 6 different projects inside. One of them dispatcher. When I set a breakpoint it tells me I dont have symbols loaded. I specified the main folder in the debug symbols dialog and it still wont let me at it.
Please help me dude
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
nvm, the VS.NET IDE really bites as far as debugging reliability is concerned
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Hello, I have a c# assembly that gets called by unmanaged code (it gets called by Internet Explorer, like a plugin).
What I want to know is, how do I get the thread ID of the current thread? If I use System.Threading.Thread.CurrentThread, I can only get the name. As I understand it, C# threads are not the same thing as old win32 threads. But since my C# assembly is being called by unmanaged code, it is definately running on one of those win32 threads, how do I get the thread ID?
thank you
"Outside of a dog, a book is Man’s best friend. And inside of a dog, it’s too dark to read."
-Groucho Marx
|
|
|
|
|
Have you tried the GetCurrentThreadID() API? I know it's best to stick with the managed versions of the Win32 APIs, but this might give you what you want with no ill affects.
|
|
|
|
|
Well Thread.GetHashCode Will but as you guessed its a managed thread ID which isnt a win32 id because really it runs in appDomains and other factors. The key word is managed AKA hosted
<br />
Note An operating-system ThreadId has no fixed relationship to a managed thread, because an unmanaged host can control the relationship between managed and unmanaged threads. Specifically, a sophisticated host can use the fiber API to schedule many managed threads against the same operating system thread, or to move a managed thread between different operating system threads.<br />
hope this helps
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Also SYstem.AppDomain.GetCurrentThreadID
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
I'm working with the Reflection functions to dynamically load and invoke methods on a given assembly. I'm able to load and invoke methods as long as the parameters are not defined as ref or out. How do I invoke those methods with parameters marked as ref or out?
Thanks...
|
|
|
|
|
Hiya... something like...
Type t = myDynamicallyLoadedObj.GetType();
MethodInfo m = t.GetMethod("Swap");
args = new object[2];
args[0] = 1;
args[1] = 2;
m.Invoke(myDynalicallyLoadedObj,args);
where myDynamicallyLoadedObj.Swap is defined as...
public void Swap(ref int a, ref int b)
{
int x = a;
a = b;
b = x;
}
Will do the trick... same for outs AFAIK...
HTH
-----------------------------------------------------------------------
Shaun Austin: .NET Specialist. Spreading the word of .NET to the world... well the UK... well my tiny corner of it!!
|
|
|
|
|
Can anyone recommend a 3rd party component/framework for adding simple visio-like drawing capabilities to an application? Does not need to by complex - only dealing with 3-5 shapes. Need ability to drag shapes onto workspace, draw connector lines between shapes - rubberband connection as shapes are moved, allow text and image to be placed in shape.
Thanks,
Steve
|
|
|
|
|
seems like a cool and easy project
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
I recommand you my flowcharting product: AddFlow for .NET.
You can download an evaluation version at:
http://www.lassalle.com/download.htm#.NET
|
|
|
|
|
Can someone give me the code for Dijkstra algorithm in c#, i have seen the article written on shortest path and bowloaded the code and i still can't seen to find it. Any help would be greatly appreciated!!
Thanks,
Da Intern
|
|
|
|