|
|
Perhaps set the .MinimumSize to the .Size in the Load event handler?
|
|
|
|
|
hi guys! I have a listview with a PDF's from a local folder. when the item is double clicked I want to be displayed. What is the best way of doing this? I haven't do any coding for opening PDF
's before. Thx ahead for reading this post
|
|
|
|
|
.Net doesn't provide PDF support by default. You'll need to get a 3rd party PDF library, or display it by calling external software.
PDF Library - Google for one, there's about a gazillion.
External software - like adobe or foxit. You'll need to ensure it's installed, maybe setup some kind of prerequisite in your app's installed, the call it from your software. Or possibly just open the pdf file and let windows kick in to choose the software.
Simon
|
|
|
|
|
laziale wrote: when the item is double clicked I want to be displayed.
Process.Start("pdffilename.pdf")
|
|
|
|
|
it says that access is denied
|
|
|
|
|
ok...I know what is it. I solved, the thing was that I had ToString declaration, and with that my string it get's the item from the list view like this:
"ListViewItem: {C:\\document.pdf}"
now, I did item.text, and it works perfect. Thx
|
|
|
|
|
PDF Creator/fly2pdf[^]
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
Hi
I recently posted a question on ArrayList and although I would still like an answer, I have decided to use the Hashtable class instead of a 2-dim array. Anyway, I have created a small test example and am able to successfully store and retrieve values. However, I tried storing the hashtable in a session and then retrieving it but get an error on retrieving (so assume it has stored it as no error on that line). My timeout is 2000 so I'm sure that is not the problem. Anyway, here is my code:
protected void Button1_Click(object sender, EventArgs e)
{
Hashtable myHash = new Hashtable();
myHash.Add(TextBox1.Text, TextBox2.Text);
//store the hash table in a session object
Session["BooksOrdered"] = myHash;
//retrieve the details from the session object
Hashtable booksOrderedHash = new Hashtable();
booksOrderedHash = Session["BooksOrdered"];
// Loop over the list, writing out the value
foreach (DictionaryEntry myEntry in booksOrderedHash)
{
Response.Write(myEntry.Value);
}
}
The error is:
Cannot implicitly convert type 'object' to 'System.Collections.Hashtable'. An explicit conversion exists (are you missing a cast?)
Line: booksOrderedHash = Session["BooksOrdered"];
Any help would be greatly appreciated as I've spent since 10am this morning on this
|
|
|
|
|
you need to cast your Session["BooksOrdered"] to a hash table like so
booksOrderedHash = (HashTable)Session["BooksOrdered"]
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
2 minutes faster than me
That'll teach me for trying to be sarcastic.
Simon
|
|
|
|
|
hehe, let it be a lesson my friend
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
Thank you very much for your non-sarcastic reply to my stupid question
If anyone is interested, here is an example to check if a value exists in the hashtable,
if (!myHashTable.ContainsKey("keyToSearchFor"))
{...
}
Today so far I'm enjoying programming )
|
|
|
|
|
That's a compiler error. The trick with compiler errors is to actually read them.
Member 3402886 wrote: Cannot implicitly convert type 'object' to 'System.Collections.Hashtable'
Yup, the problem here is that the compiler is telling you that you cannot implicitly convert an object type to a hashtable type.
Member 3402886 wrote: An explicit conversion exists
Oh great, it's telling us that an explicit conversion is possible.
Member 3402886 wrote: (are you missing a cast?)
Yup, it turns out that you're missing a cast. The compiler was right!
Member 3402886 wrote: booksOrderedHash = Session["BooksOrdered"];
Should be this:
booksOrderedHash = (Hashtable)Session["BooksOrdered"];
(If you use this in production code, you should probably check that the BooksOrdered object exists in the session first, then check it is of a hashtable type before you cast it.)
Simon
|
|
|
|
|
Hi,
I have to display images of different sizes as Thumbnail on Windows Form. I am using Imagelist and Listview COntrol to load the images. But Imagelist is resizing the images to its Pre-defined size or all the images are resized to same dimensions.
Can anyone please advise me on how can i display images in the correct aspect ratio?
Thanks in Advance!
Pallavi
|
|
|
|
|
I have some listView control that i use.
On this listView i hold 3 column.
When user click on some item in the listView - and the click was on column 2 on the second item - how can i know it ?
What i mean is - i want to know witch column and witch item was the click on.
Thanks for the help.
|
|
|
|
|
Hi,
I have been testing my problematic install on my machine at work and it works as expected. The two similarities between my dev machine and the machine at work is that they both have System.Data.SqlSeverCe in the C:\Windows\assembly directory ... my test machine does not which is where I'm seeing the errors trying to create the database ...
I have System.Data.SqlServerCe referenced in my application and set to Copy Local=True, I also have the other 7 DLL's related to SQL included in my build and distribution.
To test this, on my working install I moved the System.Data.SqlServerCe.dll file out of the install directory and my app still worked. I think for some reason that its actually using the .dll in the GAC not the local one.
I thought this is what the Copy Local setting was for when you build a release version ...
Any help on this would be great.
Cheers,
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Hi All,
I have just confirmed that this is the problem. I manually installed SQL Compact on the test machine and my app runs.
I've followed MicroSoft's instructions to the letter for distributing a local copy of SQL Compact with my application. What would be causing my app to ignore the local dll and crash becuase it can't find the dll in the GAC?
Should I be changing the Reference Properties setting 'Alias' from 'global' to 'local' or something like that?
TIA,
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
hi all
i'm using C# to process and send mails to recepients using SMTP, lately i've been requested to add functionality to my code where i'll be able to resolve outlook distribution lists into their respective mail addresses.
as i'm restricted to C# i cannot do this via MAPI, i've tried googling the solution but cannot find a solution that will return the resolved mail addresses. i'll also add i cannot use the Redemption library (can't use anything unless i wrote it in house)
|
|
|
|
|
Hi
I am very new to C# programming (classic asp trained) so please bear with me if I'm being stupid!
All I want to do is declare a 2 dim array but it will be dynamic as I don't know what the size will be. I have been searching the web and it looks like I should be using ArrayList(). However, I cannot find any examples as to how I declare it - it doesn't like the first line in my code as it's looking for a size:
e.g
ArrayList itemsArray = new ArrayList[,];
itemsArray[0,0].Add(TextBox1.Text);
itemsArray[0,1].Add(TextBox2.Text);
Response.Write(itemsArray[0,0]);
Response.Write(itemsArray[0,1]);
Please help as I've been spending hours looking for an answer and about to change career!
|
|
|
|
|
I would use a generic list instead. What type of data/object is going in the first indexer?
Dave
|
|
|
|
|
Hi Dave
Thanks very much for your prompt reply. I have discovered that the ArrayList can only be used for single dimension arrays but it can be used to store objects. Anyway, I've since tried a simple hash table and I managed to add and retrieve values but need to store the hashtable in a session but it refuses to let me retrieve the values - I have posted another question on this about 5 mins ago! I'm on a roll now I see I don't have to wait long to get an answer - perhaps I will stay with programming for now anyway
Thanks
Lorna
|
|
|
|
|
Member 3402886 wrote: perhaps I will stay with programming
Stay with it, it's very rewarding IMHO.
I only do WinForms not ASP.net so I'm not sure about storing values in a session.
From your other post it appears you need a list of 2 strings. This can be done many ways. A dictionary is probably the way to go Dictionary<string, string> myDictionary = new Dictionary<string, string>(); . Alternatively, you can create your object with two string properties and create a List<t> of instances of that.
Dave
|
|
|
|
|
There are different ways of approaching the issue.
What I tend to do is use a list that contains a list as it is more efficient.
However an ArrayList is also fine if you are not too bothered with getting the best performance.
The trick lies in how you retrieve the data.
What you need to do is cast the result from your ArrayList into an Arraylist which you can then work with.
We declare an our main ArrayList:
ArrayList OuterList = new ArrayList();
We then declare our internal ArrayLists adding some data to the ArrayList:
ArrayList InnerList = new ArrayList();
InnerList.Add("SomeData")
InnerList.Add("SomeMoreData")
Then we add InnerList to OuterList so in effect we have an ArrayList of ArrayLists
OuterList.Add(InnerList);
Now the magic comes in extracting the InnerList ArrayLists from OuterList.
We do this by explicitly casting InnerList as an ArrayList as follows:
ArrayList InnerList = (ArrayList)OuterList[Idx];
We can then iterate through InnerList pulling all the elements out.
You will need to play with this code to get it to do exactly what you want - it is just for illustrative purposes.
Also there will be better ways of doing things (as this is expensive processor-wise) - it's more a case of if you can grasp the concept of boxing and unboxing(casting) you will have one more very useful bit of C# under you belt.
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
modified on Monday, June 30, 2008 11:47 AM
|
|
|
|
|
How to avoid duplicate items from the list?
for example consider
list contains 1,2,1,2,3,1,3,1,4,1,2,1,4
actually i want only ones that item placed in list(1,2,3,4) others want to be removed. it is possible? then How?
|
|
|
|