|
Hi.
Have you considered ClickOnce ?
Kjetil
|
|
|
|
|
Hello,
could anyone solve my problem. I have application working with MSSQL Server: there is one table "goods" (id, name) and another one - "info" (id, idgood1, idgood2, info), where idgood1 and idggod2 - foreign keys.
In my application I need to present a DataGridView in such a way,
_______| goods1 | goods2 | goods3
goods1 | info11 | ______ | ______
goods2 | ______ | ______ | info23
goods3 | info31 | ______ | info33
I select data from two tables ("goods", "info") in appropriate DataTable instances: GoodsDataTable and InfoDataTable. Then I CREATE (dynamically) one more DataTable - VisualDataTable, which IS what i need. Then I put VisualDataTable into DataSet, DataSet into BindingSource, and, finally, BindingSource into DataGridView. It's working. Until I want to update something!
I tried to call SqlAdapter's Update method as for InfoDataTable as DataSet. But nothing happens.
In general, how should I update data in case when "visual" part of DataGridView and database structure are different..?
Another words, I take data from database, and put data into database with one table, and I edit data with another table.
|
|
|
|
|
Your design is a bit blur. What I understand form your post is that you combine two tables into one, this is called DataView object which should be in the SQL server layer of your program.
Create a SqlCommand that creates a DataView combining both tables then make your SELECT/UPDATE commands on that view. Both tables will be updated accordingly.
I hope I got you right.
Regards
|
|
|
|
|
OK, I'll show an example
"Goods" Table:
id | name
---------
23 | foo1
24 | foo2
25 | foo3
"Info" Table:
id | idgood1 | idgood2 | info
-----------------------------
10 | _____23 | _____24 | inf1
11 | _____23 | _____25 | inf2
12 | _____24 | _____25 | inf3
I want to see in DataGridView such structure (first row - row header, first column - column header):
____ | foo1 | foo2 | foo3
--------------------------
foo1 | ____ | inf1 | inf2
foo2 | ____ | ____ | inf3
foo3 | ____ | ____ | ____
|
|
|
|
|
I've created a form with 'WindowState' set to "Maximized", so that the window starts in fullscreen. I don't want the user being able to restore the window back to it's original size, so I've disabled the "Maximize" button, and I've set the 'FormBorderStyle' to "Fixed Dialog".
However, I can still double-click the form and resize it back to it's original size, so I'm wondering what can I do to prevent this?
I'm using MS Visual Studio 2008 for what it matters.
Note: I'm fairly new to C#, so I'd appreciate it if you could be as detailed as possible if you got any suggestions.
Thanks in advance
|
|
|
|
|
Don't think you can prevent it happening, but you can respond and reverse the action.
Handle the "resize" event on the form (in the properties window, click the events button, find the resize event and double click on it), add some code that checks if the windowstate state is maximised. If it's not, set it to maximised.
Simon
|
|
|
|
|
You should be able to do it by overriding WndProc and intercepting the WM_ENTERSIZEMOVE (0x0231) message, or another similar message if that one isn't sent in your situation.
Dave
|
|
|
|
|
|
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
|
|
|
|