|
Write your own code to change the colour of the whole row when it is selected.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
OK, I guess you mean I should select custom color for the line when the control is not in focus (in case 'HideSelection' property iquals 'true').
How do I do that?
Thanks!
|
|
|
|
|
Get a reference to the item(s) that are selected from the SelectedItems property of the control. Then set the BackColor property of each item to an appropriate colour.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
How can i store path name of zip file in DataBase Sql Server so user can download it easily with out effecting on database.
|
|
|
|
|
Member 4370898 wrote: How can i store path name of zip file in DataBase Sql Server so user can download it easily with out effecting on database.
Your question doesn't really make sense.
You want to store a file path in your SQL database? So, just stick it in a table.
What do you mean, 'with out effecting...'?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
It's just a string, so just store it.
Either you really shouldn't be working on a database app until you learn some basics or ( more likely ) you've not asked what you meant to ask. Is the issue that you don't know how to store the zip files logically in your file system ? There's a Path.GetTemporaryFileName ( or similar ) method you can use to create meaningless unique file names if you're worried about collisions.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Actually i want to store physical path of file in database.so help me.
|
|
|
|
|
Hi All,
I need to consume a XML and I have Request XML and some C# code to consume response.
Now as far as I have seen we can directly call webmethods, by adding web reference.
Not sure if we can use Request XML to call web method. If we can, is there a sample or article discussing this?? Whats the ideal way of doing this??
|
|
|
|
|
You could write a simple web service that returns XML by using a HttpHandler. More information on this topic can be found here[^].
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Thanks Paul...I dont have control over creating that service. I need to consume that service which accepts and return XMl using Soap. Now the question is "Can I make a request to that Service using Soap XML instead of directly calling those web methods from codebehind??
Keep DotNetting!!
GeekFromIndia
|
|
|
|
|
Yes, although I haven't tried to do it myself. The following Google[^] search threw up some useful information though.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Can someone please tell me if I'm approaching this incorrectly (and if so, suggest a better way) or tell me if I just can't do this at all?
I have 3 tables:
Table 1
tableOneID (PK)
displayString
Table 2
tableTwoID (PK)
displayString
tableOneID (FK)
Table 3
tableThreeID (PK)
displayString
tableTwoID (FK)
I want to be able to display the information in 3 combo boxes, filtered by the selection the 'upper' combo boxes. I have a dataset containing 3 datatables and have created relationships between the tables. It all works great for the first two combo boxes (cboTable_2's data is filtered correctly by selection in cboTable_1) but not for the next combo box - I want cboTable_3's data to be populated based on the selection in cboTable_2.
OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM Table_1", conn);<br />
da.Fill(ds, "Table_1");<br />
<br />
da = new OleDbDataAdapter("SELECT * FROM Table_2", conn);<br />
da.Fill(ds, "Table_2");<br />
<br />
da = new OleDbDataAdapter("SELECT * FROM Table_3", conn);<br />
da.Fill(ds, "Table_3");<br />
<br />
DataColumn masterOne = ds.Tables["Table_1"].Columns["tableOneID"];<br />
DataColumn childOne = ds.Tables["Table_2"].Columns["tableOneID"];<br />
DataRelation relation = new DataRelation("RelationMasterChild", masterOne, childOne);<br />
ds.Relations.Add(relation);<br />
<br />
cboTable_1.DataSource = ds;<br />
cboTable_1.DisplayMember = "Table_1.displayString";<br />
cboTable_1.ValueMember = "Table_1.tableOneID";<br />
<br />
cboTable_2.Datasource = ds;<br />
cboTable_2.DisplayMember = "Table_1.RelationMasterChild.displayString";<br />
cboTable_2.ValueMember = "Table_1.RelationMasterChild.tableTwoID";<br />
<br />
DataColumn masterTwo = ds.Tables["Table_2"].Columns["tableTwoID"];<br />
DataColumn childTwo = ds.Tables["Table_3"].Columns["tableTwoID"];<br />
relation = new DataRelation("RelationChildChild", masterTwo, childTwo);<br />
ds.Relations.Add(relation);<br />
<br />
cboTable_3.Datasource = ds;<br />
cboTable_3.DisplayMember = "Table_2.RelationChildChild.displayString";<br />
cboTable_3.ValueMember = "Table_2.RelationChildChild.tableThreeID";
The problem: On load this data is displayed correctly
cboTable_1 filters data in cboTable_2 which in turn filters data in cboTable_3
but when cboTable_1 and/or cboTable_2 selection is changed, cboTable_3 is not updated
Thanks for any input.
modified on Sunday, March 2, 2008 11:17 AM
|
|
|
|
|
Hi,
I want to use SHGetFileInfo from shell32.dll u can pass string or pidl(ITEMIDLIST structure) for first param the problem is: u can't convert string (file path) to pidl or vice versa. so I use IntPtr for first param. but the problem is I can't convert pidl to IntPtr.
(the problem is the code below doesn't work I can't find out why)
public class FileFolder<br />
{<br />
[DllImport("Shell32.dll", CharSet = CharSet.Unicode)]<br />
public static extern UInt32 SHGetFileInfo(IntPtr pszPath, UInt32 dwFileAttributes, ref SHFILEINFO psfi, UInt32 cbFileInfo, UInt32 uFlags);<br />
[DllImport("Shell32.dll", CharSet = CharSet.Unicode)]<br />
public static extern Int32 SHGetSpecialFolderLocation(IntPtr hwndOwner, int nFolder, ref ITEMIDLIST ppidl);<br />
<br />
[StructLayout(LayoutKind.Sequential, Pack = 1)]<br />
public struct SHITEMID<br />
{<br />
public UInt16 cb;<br />
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]public SByte[] abID;<br />
}<br />
[StructLayout(LayoutKind.Sequential, Pack = 1)]<br />
public struct ITEMIDLIST<br />
{<br />
public SHITEMID mkid;<br />
}<br />
<br />
<br />
<br />
}<br />
<br />
<br />
uint flag = FileFolder.C_GetFileInfoFlagt.SHGFI_PIDL| FileFolder.C_GetFileInfoFlagt.SHGFI_ICON | FileFolder.C_GetFileInfoFlagt.SHGFI_SHELLICONSIZE | FileFolder.C_GetFileInfoFlagt.SHGFI_ATTRIBUTES | FileFolder.C_GetFileInfoFlagt.SHGFI_TYPENAME;<br />
<br />
FileFolder.ITEMIDLIST pidl = new FileFolder.ITEMIDLIST();<br />
if (FileFolder.SHGetSpecialFolderLocation(IntPtr.Zero, (int)0x0003, ref pidl) == 0)<br />
{<br />
MessageBox.Show("true");<br />
}<br />
<br />
IntPtr pnt = Marshal.AllocHGlobal(Marshal.SizeOf(pidl));<br />
Marshal.StructureToPtr(pidl, pnt, true);<br />
if (FileFolder.SHGetFileInfo(pnt, 256, ref info, (uint)Marshal.SizeOf(info), flag) > 0)<br />
{<br />
MessageBox.Show("Successfull");<br />
}
|
|
|
|
|
Wow! it sometimes works ! a few times it is failed. I can not find out why! plz help!
|
|
|
|
|
Haven't tried it but this[^] may help
Dave
|
|
|
|
|
No, It doesn't help. because it assumes just file system paths not pidl!. you can not convert every pidl to string.
|
|
|
|
|
|
thanks,
I see the code but I can't find out why my code doesn't work properly. my code is like the code in the page that you mention. (the caller is not presented in the page just callee is presented)
modified on Friday, March 7, 2008 5:01 AM
|
|
|
|
|
Hello Amirreza_nl,
I wrote the code that was alluded to earlier in this thread (from CodeGator.com). You are correct that your code is similar to mine, however I am calling a slightly different method to get the path from the PIDL. In my case I am using the SHGetPathFromIDList function. Also, my code doesn't convert from the InPtr to a ITEMIDLIST structure. I am able to deal with PIDL's as IntPtr objects instead of converting them to ITEMIDLIST structures. (See my code here)
You don't say which call is failing in your code, is it SHGetSpecialFolderLocation or SHGetFileInfo?
My suggestion would be to try omiting the conversion of the PIDL to a struct if possible.
I hope I have helped,
Martin
Martin Cook
Jesus answered, "I am the way and the truth and the life. No one comes to the Father except through me." John 14:6
|
|
|
|
|
Hi,
first of all, thanks for ur reply. I think SHGetFileInfo doesn't work well. because the first call's return value is ok. but SHGetFileInfo's return value sometimes is not ok. I run the code 2 or 3 times then it works well and show control panel's (or something else) attributes correctly! I don't know why!
SHGetPathFromIDList doesn't work at all with something like control panel (I think). we can use it when pidl is controled by file system(file or folder that is stored physically in a hard disk). so I can not use it for my app.
typedef struct _SHITEMID {<br />
USHORT cb;<br />
BYTE abID[1];<br />
} SHITEMID;
I wrote this in C#:
[StructLayout(LayoutKind.Sequential, Pack = 1)]<br />
public struct SHITEMID<br />
{<br />
public UInt16 cb;<br />
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]public SByte[] abID;<br />
}
then
typedef struct _ITEMIDLIST {<br />
SHITEMID mkid;<br />
} ITEMIDLIST;
in C#:
[StructLayout(LayoutKind.Sequential, Pack = 1)]<br />
public struct ITEMIDLIST<br />
{<br />
public SHITEMID mkid;<br />
}
|
|
|
|
|
oh, I think I find the bug in my code!
I write:
[StructLayout(LayoutKind.Sequential, Pack = 1)]
but I must write:
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode, Pack = 1)]
instead.
I use unicode charset for my all methode definitions.
But I wonder why this makes a problem! we have two types of pidl!? on for ansi one for unicode!? why? in pidl address we have string!??
|
|
|
|
|
I am Bang Hoang Viet. I am Vietnamese. My English isn't good. I use datagridview to display data of SQL 2000 database. My data source have a lot of rows. I need view record_id 1500 on screen but i don't know how to. Nomarly I scroll datagridview go to record_id 1500 to confirm by my eyes on screen. Someone help me catch pages's record_id 1500 and display auto on screen.
Soon!
Thank very much for help me!
|
|
|
|
|
|
Thank very much!
That I known. My problem have been I had listed datagridview's record then I modify record's ID 1500. Then I upgraded database and reconnect data source to view datagridview. I want catch record's ID 1500 and view on screen and see I have modified that record. So can you help me resolve this problem.
Waitting for you and thank you very very much!
|
|
|
|
|
Can someone please help me to open a file in the application using openFileDialog. I have a button "Open File" > which then opens an openFileDialog window, I then select the file and click Open, but it does not want to open. I do get the path and everything, but it does not want to open. Maybe I am using the wrong code. Here is a snippet of my code:
//Opens the file and populates the datagrid
private void btnOpenFile_Click(object sender, EventArgs e)
{
ofdExcelDoc.Filter = "xls files (*.xls)|*.xls|All files (*.*)|*.*";
if (ofdExcelDoc.ShowDialog() == DialogResult.OK)
{
ofdExcelDoc.OpenFile();
try
{
// Attempt to open the file and output its contents to a text box
Stream stream;
if ((stream = ofdExcelDoc.OpenFile()) != null)
{
StreamReader reader = new StreamReader(stream);
//dgFileInfo.DataSource = reader.ReadToEnd();
txtOutput.Text = reader.ReadToEnd();
stream.Close();
}
}
catch (Exception ex)
{
MessageBox.Show("There was an Error: " + ex.Message);
}
}
}
}
Mvelo Walaza
Developer
Telkom SA
|
|
|
|