|
I want to pass bool values(true/false) from a datagrid view to radio buttons to another form. Reason being, I am also passing other values from the grid to another form to edit the data. How could i go about passing a true or false value so when my edit form opens the radiobuttons are populated with either a true or false value, based on what value they hold in my datatable?
Thanks
|
|
|
|
|
If you mean how do you pass the values to the new form, you can either do it via the constructor or Properties.
If you mean how do you set the radiobuttons is the .Checked property.
|
|
|
|
|
Its both actually. I want to be able to select True or False two buttons, then pass that true or false value back to my datagrid. Do you have an example of how I can do that or does it all really depend on how data is passed back to the form?
|
|
|
|
|
I have a datagrid on a web page. ASP.net.
One column is a date with an ID of DateReported. After binding the data from a SQL database to it
how do I check if that date if greater than today's date then change the colour of the cell to red. Or do I dothis as each row IS binding?
I've obviously looked on the web and have see 14 different ways to do it, all of them contridictory.
Is it not as simple as....
Foreach
{
If (ConvertToDateTime(myGrid.ColumnName.Equals("DateReported")) > TodaysDate)
{
myGrid.ColumnName.Equals("DateReported").colour.red
}
}
or similar. I'm getting rows, cells, grid items all confused after looking at the solutions offered. Any advice greatful for such a newbie.
|
|
|
|
|
I bind text box below with a string typed datarow where the column i'm going to bind is DateTime. Below id the code:
this.txtDate.DataBindings.Add("Text", m_DataRow, "END_DT", true, DataSourceUpdateMode.OnPropertyChanged, null, "dd/MM/yyyy");
when i click on a chkbox event below fired:
<br />
private void chkbox_CheckedChanged(object sender, EventArgs e)<br />
{<br />
Boolean isChecked = ((CheckBox)sender).Checked;<br />
<br />
if (!isChecked)<br />
{<br />
this.txtDate.Clear()<br />
}<br />
<br />
<br />
<br />
}<br />
Date that show in the textbox is clear. How ever the date time still exist in m_DataRow.END_DT.
I Thought when i set the txtDate.Clear it should also clear the m_DataRow.END_DT some how it won't work. Please help.
|
|
|
|
|
Did you call m_DataRow.AcceptChanges()?
On a side note, if the user unchecks the button, do not clear the text box, just make it read-only and ignore its content. If the user changes his mind, just make it editable again and he won't have to re-enter it.
-----
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
Try using txtDate.DataBindings.Remove to remove the databinding, then clear the textbox.
I get all the news I need from the weather report.
|
|
|
|
|
I am learning C# by building an application on two seperate laptops. This fact has lead me to look at how I can specify absolute paths in c#. I have searched the forum and found a number of ways to get the current path an application is running from, ie
public static string current_dir = Application.StartupPath;
However I am using VisualStudio 2005. When i Debug the application this returns: ....\bin\debug.
Thus I cannot use "current_dir" as the basis for any other directories. (Imagee, for example). I assume this should be quite simple... what am I missing?
Thanks,
Jon.
Imagine something witty is written here.
|
|
|
|
|
[d]eljay wrote: hus I cannot use "current_dir" as the basis for any other directories. (Imagee, for example).
If you mean "My Pictures" then you might want to look at Environment.GetFolder() [I think - I don't quite remember off the top of my head]
Anyway, that will allow you to supply an enumerator called SpecialFolders which includes things like the Windows directory, MyDocuments and so on (they are not all called something obvious - read the docs to see what they all mean, or create a quick console application and see what they return). The result of the method call is a string giving the path to the folder you requested.
Also, you shouldn't rely on relative paths for anything outside of your control. Folder names can be renamed or set up differently on each computer. So, if you install some software and create a subdirectory with files in it then that is fine to refer to it relative to the current directory, but not otherwise.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
Thanks for your response...
Colin Angus Mackay wrote: Folder names can be renamed or set up differently on each computer
... Exactly my problem
The folder I am trying to access exists in
c:/blahblah/projectname/solution_dir/resources/images
...current_dir = Application.StartupPath;
has already gone too deep into the tree:
c:/blahblah/projectname/solution_dir/bin/debug/
I could do a cludge whilst I am debugging and hack off the /bin/debug bit "manually" , but i would prefer to learn what i am doing wrong
I am starting to suspect it is more of a "how to use Visual Studio 2005" issue...
|
|
|
|
|
[d]eljay wrote: I am starting to suspect it is more of a "how to use Visual Studio 2005" issue...
No... Did you try looking for the method I suggested?
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
If you use the @ symbol, this will create a relative path (I think - I'm on the train at the moment, typing on my mobile...)
So that path = @"\Data\My Data" would find the data folder relative to the .exe.
"It was the day before today.... I remember it like it was yesterday."
-Moleman
|
|
|
|
|
No, the @ symbol tells the C# compiler how to interpret the string. In this case so that the slashes are not treated as escape characters.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
And there I was thinking that the @ was overloaded (actually, I'm sure I remember reading it somewhere, clearly the author of said statement was leading me up the garden path). Bugger.
So to modify my original statement, you can specify a relative path such as:
path = "data", such that:
Directory.CreateDirectory("Data");
Would create a directory called data in the same directory the .exe is running in.
"It was the day before today.... I remember it like it was yesterday."
-Moleman
|
|
|
|
|
martin_hughes wrote: Would create a directory called data in the same directory the .exe is running in.
Not quite. It will create a directory under the current directory, which may not be where the .exe is running.
|
|
|
|
|
... Ah, that saves another question... "what does the @ do" (having seen it in examples...)
|
|
|
|
|
It causes the compiler to ignore any escape characters, such as the back-slash, in any string with it pre-pended.
|
|
|
|
|
Hi,
if your app needs a set of images (that for some reason cannot be embedded as resources),
then you must choose a folder carefully, then code accordingly.
Some examples:
C:\images
it is simple, but absolute paths may give problems; C: may not exist or not be accessible
folder where exe is
that's what you get automatically
one of the children of that folder
use a relative path such as "\images"; may be inside "C:\Program Files" and might be
write=protected !
BTW you can go upstream with \.. (but that in general is a bad idea; I do it while
developping to get to the project folder: \..\.. removes \bin\debug)
[userdatafolder]\theAppName\images
a much better choice; the system provides a location to put application data that is
user dependent; it typically refers to C:\Documents and Settings\theUserName\Application Data
you should append at least \theAppName and optionally some more grouping (say \images)
you get [userdatafolder] from Environment.SpeicalFolder.ApplicationData; so
I would suggest Environment.SpeicalFolder.ApplicationData+@"\theAppName\images"
|
|
|
|
|
Thanks Luc,
I think you have pinned down the bit i was missing:
Luc Pattyn wrote: ...(that for some reason cannot be embedded as resources),...
I will look at how i should be doing this!
|
|
|
|
|
You're welcome.
It is a bit unfortunate you failed to ask what you really wanted, so several people
explained about directories, folder paths, ...
|
|
|
|
|
Hi,
actually i am developing an application in which i had to dynamically create a datagrid, add columns, assign DataPropertyName to the columns.
if for example there are 2 columns in the grid than 2 textboxes are located at the bottom end of the grid which will contain the particular cell value.
inserting, editing is done from these textboxes. what i want is all the insertion, deletion or editing should be manipulated in the dataset or datatable & when i exit from the form than it will ask for "do you want to save these changes" if yes than the database is updated.
can anybody give some idea how to achieve so?
thanks in advance.
|
|
|
|
|
Hi,
My C# prog uses global hooks to listen to what my mouse does in Google Earth (GE), and with the GE API I make GE do some things for me based on the mouse events. At a certain point when I click around in Google, I get this:
Retrieving the COM class factory for component with CLSID {8097D7E9-DB9E-4AEF-9B28-61D82A1DF784} failed due to the following error: 8001010d.<br />
<br />
Error Code: 8001010D<br />
"An outgoing call cannot be made since the application is dispatching an input-synchronous call."
So I think it has to do with that I am asking GE to do two things at a time. Is there a simple trick to avoid this? A timer??? Threading?
I'm still somewhat a beginner
Cheers -Gj
But because I build this methods that
D flat
|
|
|
|
|
Hi
I am having a nightmare trying to convert a web service call into a c# class so i can serialize the call.
I am trying to serialize the GetUserCollectionFromGroup Sharepoint 2007 web service
here is the XML although i do not know if this is correct as i found it on the web
<code>
<?xml version="1.0" encoding="utf-8" ?>
<dfs:myFields xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:s0="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2004-03-16T06-17-54" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<dfs:queryFields>
<s0:GetUserCollectionFromSite>
</s0:GetUserCollectionFromSite>
</dfs:queryFields>
<dfs:dataFields>
<GetUserCollectionFromSiteResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/directory/">
<GetUserCollectionFromSiteResult>
<GetUserCollectionFromSite>
<Users>
<User ID="1" Sid="S-1-5-21-3593225548-2099380924-3969701235-500" Name="User1" LoginName="login1" Email="user1@users.com" Notes="" IsSiteAdmin="False" IsDomainGroup="False"/>
<User ID="2" Sid="S-1-5-21-3593225548-2099380924-3969701235-1145" Name="User2" LoginName="login2" Email="user2@users.com" Notes="" IsSiteAdmin="False" IsDomainGroup="False"/>
</Users>
</GetUserCollectionFromSite>
</GetUserCollectionFromSiteResult>
</GetUserCollectionFromSiteResponse>
</dfs:dataFields>
</dfs:myFields>
</code>
I have tried using the xsd.exe file to convert it but i get the following error
Error: There was an error processing 'C:\InfoPathUserListDummyData.xml'.
- The same table (GetUserCollectionFromSite) cannot be the child table in two nested relations.
Please can someone help
Thanks in advance
Paul
|
|
|
|
|
If you add a web reference to the web service Studio will handle all that for you. If you really want to manually serialize, try Skeleton Crew[^], XSD.exe is next to horrible.
|
|
|
|
|
Are you having problems parsing the xml?
Manually you can do it:
XmlDocument d = new XmlDocument();
d.LoadXml( ... );
XmlNamespaceManager x = new XmlNamespaceManager(d.NameTable);
x.AddNamespace("xml", "http://www.w3.org/XML/1998/namespace");
x.AddNamespace("dfs", "http://schemas.microsoft.com/office/infopath/2003/dataFormSolution");
x.AddNamespace("s0", "http://schemas.microsoft.com/sharepoint/soap/directory/");
XmlNodeList list
= d.SelectNodes(
@"
/dfs:myFields
/dfs:dataFields
/s0:GetUserCollectionFromSiteResponse
/s0:GetUserCollectionFromSiteResult
/s0:GetUserCollectionFromSite/s0:Users/s0:User", x);
This will get the list of users.
I'm largely language agnostic
After a while they all bug me
|
|
|
|