|
Wow. Nothing like doing his homework for him! Great! Now he didn't learn a thing and will fail on the next project.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
This is obvioulsy homework, I am sorry that someone did it for you. It won't help you learn. Now that you have the code, look at it, think about how it works, and what you were supposed to learn from writing it yourself.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
OK - you've posted the same question twice now. You should reply/add clarifications on the one below, plus you really shouldn't try to get us to do your homework for you. That's just lazy, and you will come away with the only lesson learned being that we know more about programming than you do.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Yet another homework poster
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
I have a class for some stuff and i want to make a new object every time i get an indication of a new node.
I would like to make the name of the objects dynamical, i.e.
Node NewNode = new Node();
I would like the NewNode to have a number after it, so I tried:
Node "NewNode"+Number = new Node(); but this won't work
Does anyone know how i can do it??? Rather not with arrays because then i'll have to predefine how big my array has to be, and I don't know that.
Thanks
|
|
|
|
|
You're much better off using a collection for this. Why not look at a generic List ? Then you would get the following code (as an example):
private List<Node> _nodes = new List<Node>();
public void AddNode(Node node)
{
if (node != null)
{
_nodes.Add(node);
}
}
public void AddNode(Node[] nodes)
{
if (nodes != null && nodes.Length > 0)
{
_nodes.AddRange(nodes);
}
}
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
List<Node> nodeCollection = new List<Node>();
...
Node newNode = new Node();
.. set unique values
.. use in unique processes
nodeCollection.Add( newNode );
This will let you have a group of objects with an unknown number created without concern for the name of the object.
|
|
|
|
|
Hi! newbie here just asking which of the following code is more efficient
1.
DataRow[] dataRowArray = dtDataTable.Select("TableColumn = 1");
foreach(DataRow drRow in dataRowArray)
{
...some processing here
}
OR
2.
foreach(DataRow drRow in dtDataTable.Select("TableColumn = 1"))
{
...some processing here
}
my problem here is do I need to put the result in a datarow array to make it more efficient? or not an issue at all?
|
|
|
|
|
Both the statement will give same efficiency.
If you have a scenario where you want the result object of dtDataTable.Select("TableColumn = 1") , then go for the first statement.
otherwise go for the second.
|
|
|
|
|
Hi Friends,
Please help me for the below requirement.
Note:
Typed Datasets are considered for the requirement.
Here, LookupTableDataSet Typed Dataset consists of the Agency and Authority DataTables.
I have two methods as given below.
public Int32 GetRowsInTable(String tableName)<br />
{<br />
Int32 result = 0;<br />
<br />
LookupTableDataSet ds = new LookupTableDataSet();<br />
<br />
System.Data.DataTable dataTable = Fill(ds.Tables[tableName]);<br />
result = dataTable.Rows.Count;<br />
<br />
return result;<br />
}<br />
<br />
<br />
public LookupTableDataSet.AgencyDataTable Fill(LookupTableDataSet.AgencyDataTable dtAgency)<br />
{<br />
AgencyTableAdapter adapter = new AgencyTableAdapter();<br />
adapter.Fill(dtAgency);<br />
return dtAgency;<br />
}<br />
<br />
public LookupTableDataSet.AuthorityDataTable Fill(LookupTableDataSet.AuthorityDataTable dtAuthority)<br />
{<br />
AuthorityTableAdapter adapter = new AuthorityTableAdapter();<br />
adapter.Fill(dtAuthority);<br />
return dtAuthority;<br />
}
1. GetRowsInTable(String tableName) should return the row count for the table name sent as the parameter.
2. Fill() method is overloaded with different types of input parameters and return types.
My requirement is that I have to pass the table name as the parameter to the GetRowsInTable() method to get the rows count for the table.
As the Fill() method is overloaded with different types of input parameters how can I convert the input parameter to a specific type based on
the tablename which was sent as a parameter to the GetRowsInTable() method?
When I call the fill method as Fill(ds.Tables[tableName]), A System.Data.Dataset is being passed to the Fill() method where the fill method will accept only types
LookupTableDataSet.AgencyDataTable or LookupTableDataSet.AuthorityDataTable.
How can I dynamically convert the System.Data.DataSet to the required type to call the Fill() method.
Also, please suggest me on dynamically casting the return types of Fill() methods.
Statement throwing compilation errors were shown in Bold+Italic.
Thanks in advance.
Subrahmanyam K
|
|
|
|
|
It looks like your method has custom types in it, I've nevr heard of an AuthorityDataTable before.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Yes, you are right. I have custom types.
LookupDataSet is a Typed Dataset and AuthorityDataTable is a Typed DataTable in that dataset which maps to the Authority database table at the back-end.
Subrahmanyam K
|
|
|
|
|
Hi,
Im creating a new user account in the windows account here the username=tricomp and password=tricomp and the domain name=TRICOMPTECH
Actually whats my query is,im using C# Windows.Net 2003 here in the form in textbox1 im entering the username as "tricomp" and in textbox2 im entering password as "tricomp" and im passing the domain name as "TRICOMPTECH"..Now while onclicking the ok Button if i entered the correct username and password means i need messagebox.show("validuser") else messagebox.show("Invaiduser").and also specify what are all the namespace i have to refer...How do i accomplish this..since im trying this process for last one week but im couldn't get the clear solution..Plz help me..
regards
Kanna...
|
|
|
|
|
|
Hi
Thanks for ur reply.I couldn't understand c++ coding will u able to give in windows c#.net?
Regards
Kanna..
|
|
|
|
|
No.. I have only C++ code.
|
|
|
|
|
You have already posted about this issue. People have posted solutions for you there - it is extremely bad form to start a new thread just because you find it a little difficult. If you have problems with a solution, then reply to the poster, don't start a new thread.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I have asynchronous method in the webservice.
I have call back method and from this call back method I have raised an event.
But the problem is when I refer this web service, the event that has been exposed by webservice is not seen in client application.
Thanks.
|
|
|
|
|
Hi,
I am facing a cross-thread communication problem in my application.
Let me explain in detail:
My application runs on a third party software. On the click of a button on the third party GUI, I need to open and play MediaPlayer and on the click of another button, I need to Stop the MediaPlayer.
After lot of research, the only way I found to play and control a mediaplayer was by adding the wmplayer control on to a window form and control it using ctlcontrol method of wmplayer component.
Now to instantiate this form class, I need to open a new thread from the main thread of my application. I am doing this in the 'Play' button click handler.
Now on the click of 'Stop' button on the thrid party GUI, I need to close this particular form and close the thread. Here, I am getting the CROSS THREAD OPERATION EXCEPTION. Can someone tell me how can I close this form on click of Stop button on the third party GUI?
Here's the sample Code:
public void OnPlay(TrtReceiveData receiveData)
{
Thread startModulesThread = new Thread(new ThreadStart(this.videoAlbum.VideoPlay));
startModulesThread.SetApartmentState(ApartmentState.STA);
startModulesThread.IsBackground = true;
startModulesThread.Start();
}
void VideoPlay()
{
String videoThumbnailPath = @"c:\ch1_video_08.mpg";
Application.Run(playBack = new PlayBack(videoThumbnailPath));
}
void StopPlayback()
{
//WHAT NEEDS TO WRITTEN HERE TO CLOSE AND EXIT THE FORM??
}
public partial class PlayBack : Form
{
public PlayBack(String path)
{
InitializeComponent();
axWindowsMediaPlayer1.URL = path;
axWindowsMediaPlayer1.Ctlcontrols.play();
}
}
Thanks,
Kraj
|
|
|
|
|
You are getting the cross thread application basically because of the nature of windows controls. Windows form controls are not Thread safe meaning if you instantiate a contol in a thread (main thread) and try to access the data from other thread it won't allow you to do that way.
Now in order to access the other control you have to use Invoke method for the control.
Have a look at the following articles.
http://www.codeproject.com/csharp/threadsafeforms.asp
http://msdn2.microsoft.com/en-us/library/ms171728.aspx
|
|
|
|
|
hi everyi,
i don know how to explain this with words...but below is the result that i wan to get.
for example:
display = 4 rows and coloums
display in #
Result:
####
####
####
####
hope u understand..
|
|
|
|
|
This is like a school project.
for(int i = 0; i < 4; i++)
{
for(int j = 0; j < 4; j++)
{
Console.Write("#");
}
Console.WriteLine();
}
|
|
|
|
|
This is in C# yeah? Is this a console app?
Don't completely understand what you want, the first thing that comes to mind is to create an array, fill it up with #'s (or you can code it so they enter in the output) and iterate that array on the page.
Hope this gives you some idea to the desired solution!
|
|
|
|
|
Well, the most straightforward solution would be:
Console.Write("####\r\n####\r\n####\r\n####\r\n");
However, that is probably not the solution that you need to complete the assignment. Why don't you just paste the assignment and explain what you are having problems with?
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi Everyone,
I've got a ASP.NET C# website but I have an issues with the standard printing functionality that Internet Explorer offers you. If the person doesn't choose to print the webpage with the setting "To Fit" but leaves it set to 100% then the printer ends up chopping off some of the words at the end of some lines. I've decided to make my own printing page, (which is no problem) but the problem I do have is that I don't want to make a seperate printing page for all pages on my website.
In whole, does anyone know a way of constructing one page that can possibly handle all the printing of the website. In other words when people press my custom print button on the page, it redirects them to my one page.
I have the feeling I'm really bad at explaining this, and I have the feeling it's impossible. Hope there is something though!
Cheers,
Michael
|
|
|
|