|
leckey wrote: I get the error or no row on line 0 in both cases.
The problem must be that the table just doesn't have any rows in it. If all else fails, you can create a new DataRow and populate the Columns collection manually. Anyways, why are you trying to set the ItemArray on the new "blank" row if you want it to be blank? Setting the ItemArray will give it values.
leckey wrote: But they still need people who can drive a combine.
I hear that babes love men who drive combines in Sean Penn movies. You'll be a star, baby! Don't forget about me when you're a rich and famous Hollywood star.
|
|
|
|
|
I found about 5 articles on inserting a blank row and this method seemed the best for my needs. That's how he set it up.
Josh Smith wrote: populate the Columns collection manually
nah?
Josh Smith wrote: Setting the ItemArray will give it values
As I mentioned above, this is how the guy did it in his example...and it worked on the northwind database. Of course he was just dumping out records as opposed to filtering like me.
|
|
|
|
|
Ok - but the new row won't be blank. That's all I'm saying.
Cheers,
Josh
P.S. When you're a famous Hollywood combine driver, don't forget the little guys (like me) who helped you get there.
|
|
|
|
|
leckey wrote: @PartID varchar
Shouldn't the varchar have a size assigned to it? e.g varchar(64)
Or does your stored-procedure only take one character as its parameter?
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
Good catch!
|
|
|
|
|
Yes, I did forget to assign a size to it. I have fixed that but trying something else now. My main problem now is I am trying to add a new line to the grid and keep getting "no row at position 0." i'm clicking a button to insert the line...
DataTable dt = ds.Tables["Rest"];<br />
DataRow row;<br />
row = dt.NewRow();<br />
row.ItemArray = dt.Rows[0].ItemArray;<br />
row["PartNumber"] = strPartNumberInputReference;
|
|
|
|
|
Have you verified that dt.Rows.Count is not 0?
|
|
|
|
|
um, no. That's probably it. Since they are hitting the add part button, there is no data in the datagrid yet. I'm wondering if I can bind a blank datagrid so it technically has a row, or if it is just null.
|
|
|
|
|
leckey wrote: row.ItemArray = dt.Rows[0].ItemArray;
row["PartNumber"] = strPartNumberInputReference;
Why are you trying to assign the values of row 0 to the new row?
When there is no data in the table, you won't have a row 0
Can't you just do
row = dt.NewRow();
row["PartNumber"] = strPartNumberInputReference;
dt.Rows.Add(row)
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
Okay, at least got it to compile and have a blank row. However, not showing what I entered in the textbox in the PartNumber column.
DataTable dt = ds.Tables["Rest"];<br />
DataRow row;<br />
row = dt.NewRow();<br />
strPartNumberInputReference = txtPartNumberInput.Text;<br />
row["PartNumber"] = strPartNumberInputReference;
Just shows blank. Any ideas?
|
|
|
|
|
leckey wrote: DataTable dt = ds.Tables["Rest"];
DataRow row;
row = dt.NewRow();
strPartNumberInputReference = txtPartNumberInput.Text;
row["PartNumber"] = strPartNumberInputReference;
Just shows blank. Any ideas?
After the call to dt.Rows.Add(row), is the information in the DataTable?
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
Let me try to explain what is happening.
In the text box enter '123' and click the Search button.
Nothing for '123' so grid comes back empty. Just the headers.
Click the second button 'add part' and that's where I want it to add a new line, with the column part number filled with that '123' entry.
I'm not sure what I did now. When I click the 'add part' a row does show up, but it is returning data that has nothing to do with the entry.
|
|
|
|
|
leckey wrote: I'm not sure what I did now. When I click the 'add part' a row does show up, but it is returning data that has nothing to do with the entry.
What data is it returning? Data that is in the table or some other.
I use similar techniques to what you are trying a lot and haven't had this problem. Is this an ASP.NET or WinForms app?
Is it the display that is wrong or is it the actual datatable? When you put a watch on the DataTable, does it get the correct data in the new row.?
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
I'm having problems with creating a process to show a webpage, and the object returned not having a valid handle. The page loads fine in all instances, but without a working handle I'm stuck on some activities to perform on the open window. I'm stumped as to the pattern involved. This seems to not work at boot, and at some point spontainiously begin providing a handle and then continue to do so for the remainder of the session. Once it started working hte only time it stopped again was after I un/redocked my laptop to attend a meeting. Any thoughts on what's going on here?
m_helpBrowser = new Process();
m_helpBrowser.StartInfo.FileName = "IExplore.exe";
m_helpBrowser.StartInfo.Arguments = indexPath;
m_helpBrowser.Start();
if (this.m_helpBrowser.MainWindowHandle.ToInt32() == 0)
MessageBox.Show("browser opened with no handle");
|
|
|
|
|
Hi!
Seems to be a timing problem.
Immediately after the process has been started, IE sometimes doesn't seem to have had enough time to create the main window, so you'll get IntPtr.Zero .
The documentation for Process.MainWindowHandles suggests calling Process.WaitForInputIdle to make sure the process had enough time to start up completely.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Adding the WaitForInputIdle call's removed the null handle problem, instead I'm occasionally getting an "invalid window handle" error when using the win32 api call GetWindowThreadProcessId and passing the process handle. The handle number my error catcher displays appears to be a random int. Eventually it spontainiously starts working again.
-- modified at 16:24 Monday 26th June, 2006
|
|
|
|
|
Based on about a dozen reboot cycles, the garbage value for the handle is only occuring in the first instance of my app launched, and is present for multiple close the browser/open a new one cycles. A 2nd copy started and running concurrent to the first will be able to successfully use the Process's handle each time even while the 1st is still creating new garbage values. Delay in starting the app, delay between starting the app and opening the browser, and delay between opening the browser and trying to use the handle all have no apparent effect.
If this is a timing issue, could it be that IE's taking longer to startup than WaitForInputIdle's maximum timeout? I'm using an old p3-550 for my reboot testing, so a timeout intended for a faster machine might be inadequate here.
|
|
|
|
|
2nd followup it's the 1st instance of IE that's the problem regardless of how it's started. starting IE before my app and I never see this.
|
|
|
|
|
I'm developing a Windows App in C#. I've been researching ways to pull my tooltip text and HelpString text (from a helpProvider control) from an external file (such as .html) instead of hardcoding it into my controls. So far I haven't found any documentation. Has anyone had experience doing this, and if so, can you enlighten me?
Jennifer Budenz
|
|
|
|
|
|
I'm familiar with HelpProvider.SetHelpString, but that requires you to type the help text that you want to be displayed directly into your code:
this.helpProvider1.SetShowHelp(this.zipTextBox, true);<br />
this.helpProvider1.SetHelpString(this.zipTextBox, "Enter the zip code here.");
What I want to do is create a file (not sure what kind of file - .txt, .html, .chm?) that contains all of my help text associated with each control. The code in my windows app project would then pull the help text from this external file, instead of having to type the help text directly into my code. I want to do this so that I have one file with all of the help text, so I don't have to go through each form in my project in order to update the text.
Any suggestions?
Thanks!
-- modified at 10:59 Tuesday 27th June, 2006
|
|
|
|
|
jbudenz wrote: I'm familiar with HelpProvider.SetHelpString, but that requires you to type the help text that you want to be displayed directly into your code:
No it does not.
jbudenz wrote: Any suggestions?
A simple Proof of Concept would be to use a XML file for the data. System.Data.DataSet to load and process the file into the HelpProvider using SetHelpString(). Later you could optimize it using a different Xml reading mechanism that is faster than DataSet.
|
|
|
|
|
Hi,
So I'm using WMI in .net with C# to start up a set of processes on a large number of remote machines. All is working well in my code to start up the processes and they are showing up fine both in WMI queries as well as in the taskmanagers of the target machines. However, as per the default for process invocation in WMI I cannot see the apps' windows on the desktop of the target machines. I've been searching around all morning to help find an answer to allow the windows to show up on the desktop so i can watch their progress, but the best I could find was some VB/WSH examples like the following...
Const SW_NORMAL = 1<br />
strComputer = "."<br />
strCommand = "Notepad.exe" <br />
Set objWMIService = GetObject("winmgmts:" _<br />
& "{impersonationLevel=impersonate}!\\" _<br />
& strComputer & "\root\cimv2")<br />
<br />
' Configure the Notepad process to show a window<br />
Set objStartup = objWMIService.Get("Win32_ProcessStartup")<br />
Set objConfig = objStartup.SpawnInstance_<br />
objConfig.ShowWindow = SW_NORMAL<br />
<br />
' Create Notepad process<br />
Set objProcess = objWMIService.Get("Win32_Process")<br />
intReturn = objProcess.Create _<br />
(strCommand, Null, objConfig, intProcessID)<br />
If intReturn <> 0 Then<br />
Wscript.Echo "Process could not be created." & _<br />
vbNewLine & "Command line: " & strCommand & _<br />
vbNewLine & "Return value: " & intReturn<br />
Else<br />
Wscript.Echo "Process created." & _<br />
vbNewLine & "Command line: " & strCommand & _<br />
vbNewLine & "Process ID: " & intProcessID<br />
End If
Anyone know how to allow desktop interaction for the processes?
|
|
|
|
|
Hi. I am developing a DRM software, and I need to hide my application from the Windows Task Manager application list. How can I do that? I think it involves "NtQuerySystemInformation" but I am not sure. I would appreciate any help. Thanks!
SUMMARY
* Need to hide application from Windows Proccess List
* Probably uses some rare windows function
Thanks!
code -> MakeBest(forever);
|
|
|
|
|
Hiding the process from Task Manager sounds like Spyware to me.
|
|
|
|