|
A) The only built-in way I know of to read an INI file is with the Windows API and P/Invoke:
<br />
[System.Runtime.InteropServices.DllImport ( "kernel32" , SetLastError=true , EntryPoint="GetPrivateProfileString" )]<br />
private unsafe static extern uint<br />
API_GetPrivateProfileString<br />
(<br />
string lpAppName <br />
,<br />
string lpKeyName <br />
,<br />
string lpDefault <br />
,<br />
byte* lpReturnedString <br />
,<br />
int nSize <br />
,<br />
string lpFileName<br />
) ;<br />
<br />
public unsafe static int<br />
GetPrivateProfileString<br />
(<br />
string lpAppName <br />
,<br />
string lpKeyName <br />
,<br />
string lpDefault <br />
,<br />
out string lpReturnedString <br />
,<br />
int nSize <br />
,<br />
string lpFileName<br />
)<br />
{<br />
int result ;<br />
byte[] temp = new byte [ nSize ] ;<br />
<br />
fixed ( byte* ptemp = temp )<br />
{<br />
result = (int) API_GetPrivateProfileString<br />
(<br />
lpAppName <br />
,<br />
lpKeyName <br />
,<br />
lpDefault <br />
,<br />
ptemp <br />
,<br />
nSize <br />
,<br />
lpFileName<br />
) ;<br />
}<br />
<br />
lpReturnedString = PIEBALD.Lib.LibStr.FromByteArray ( temp , true ).Substring ( 0 , result ) ;<br />
<br />
return ( result ) ;<br />
}<br />
B) You need to provide a reference to an instance to listView1.Items.Add(), the literal "Test" won't work.
|
|
|
|
|
Yeah I managed to fix no 2.
As for the first one, that still doesn't help...
What I need is something that can read INI Files using:
FileName, Secion Name, Key Name, and N.
N being the Nth matching key...
Any ideas?
|
|
|
|
|
how to access my outlook express from my application,sending mail ,checking mail...
ravi
|
|
|
|
|
Up to my knowledge, Outlook Express does not support automation by itself.
Therefore, you might find this link[^] useful.
SkyWalker
|
|
|
|
|
here we have to pay to download it..???
any other solution do u have...??pls suggest to me..
ravi
|
|
|
|
|
Not everything in the world is taken for free
SkyWalker
|
|
|
|
|
As regards sending mail from your application....
If you make it a web application - you've got the HTML "Mailto" - option.
- Or had you already considered that ...
|
|
|
|
|
Hi All,
Anyone know of any code tidy-up tools?
I want to group all my member declarations, all my properties, all my methods together, rather than the higgledy-piggledy mess they're in now.
Is there anything out there to help?
|
|
|
|
|
Nope, I don't think so.
It's just us who can take care of this .... manually :->
Regards,
Bhupi Bhai.
|
|
|
|
|
If you don't have time to do it right, when will you have time to do it over?
Or consider putting each in its own file?
|
|
|
|
|
hello to all friends ;
i need to use ipx connection in my (C#) project , but there is a problem , if any can help me with a little project (describing the use of ipx ) i will be grateful.
-- modified at 6:36 Wednesday 3rd January, 2007
|
|
|
|
|
Using .net 2.0
Is it possible to have a stored procedure with several select statements so that a dataset can be populated with all of the select statements. So the dataset will end up with several tables (One table for one select statement).
At present I use the dataadapter to fill the dataset. I do this for each stored procedure which holds a select statement each.
But rather than repeating this method several times (One for each select), I would like to do all this in one stored procedure and populate a dataset with the results of these tables.
Is this to do with MultipleResultSet (MRS)?
Any suggestions please?
Thanks
|
|
|
|
|
|
Shouldn't that work? Rather than a stored procedure simply have several selects in one statement?
CommandText="select blah blah blah ; select something else" ;
(With SQL server anyway, not all engines support it.)
|
|
|
|
|
Hi,
i am using a listBox that contains some items.
I tried using the double click event of the list box to make some action based on the item that is double clicked in the listBox.
But i discovered that also if i double click on the empty part of the listBox,(not on an item) the event is still fired.
I wish to know if there is a way to make sure that the event is only raised when only an item is double clicked.
thanks in advance
|
|
|
|
|
quiteSmart wrote: I tried using the double click event of the list box to make some action based on the item that is double clicked in the listBox.
But i discovered that also if i double click on the empty part of the listBox,(not on an item) the event is still fired.
You can programmatically distinguish between the two cases.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
CPallini wrote:
You can programmatically distinguish between the two cases.
How to do that?
|
|
|
|
|
use the ListBox.SelectedIndex Property
as stated in MSDN:
Property Value
A zero-based index of the currently selected item. A value of negative one (-1) is returned if no item is selected.
hence, if you got a -1 then no item is selected.
hope that helps.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
CPallini wrote: Property Value
A zero-based index of the currently selected item. A value of negative one (-1) is returned if no item is selected.
I have already tried this.
It workd fine with one exception when u select an item and then double click in the empty space it gives u the returned index as the index of the selected item
so in short this wont work perfectly.
do u have another suggestion?
|
|
|
|
|
DoubleClick event occurs when the control is double-clicked.
This is a normal behaviour.
Regards,
Bhupi Bhai.
|
|
|
|
|
quiteSmart wrote: do u have another suggestion?
Of course...
You can retrieve the Rectangle of the selected item (if there is one) and then check if it contains the point where DoubleClick occurred.
It follows an ugly example, using VB.NET (was handy, 'cause I had a VB project easyly available... Conversion to C# is straightforward):
Sub ListBox1DoubleClick(sender As Object, e As System.EventArgs)
Dim index As Integer
index = listBox1.SelectedIndex
Dim ev As System.Windows.Forms.MouseEventArgs
ev = e
If index <> -1 Then
Dim rc As Rectangle
rc =listBox1.GetItemRectangle(index)
If rc.Contains(ev.X, ev.Y) Then
MsgBox("Hello")
End If
End If
End Sub
Hope that helps.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
in your click handler, try using ListBox.IndexFromPoint()
and test for ==ListBox.NoMatches (which equals -1 I guess)
Luc Pattyn
|
|
|
|
|
Hi there,
In my project (C# Win) .NET 2.0 VS 2005, I am getting an error "Exception has been thrown by the target of an invocation". Can you please give me a clue how to debug this problem ?
Thanks
Emran
|
|
|
|
|
|
Be sure to (recursively) check the InnerException [^] property of the throwed exception.
|
|
|
|