|
Unfortunately, 95% of the people that will be using this program have 2 or more monitors (yes some have 3 and 4). It may be in my best interests to leave location alone and let Windows handle that.
Someday I'll figure it out...
|
|
|
|
|
well you can save the location as a point value in your settings.
my.settings.SaveLocation = my.settings.location
where SaveLocation is your variable.
|
|
|
|
|
IIRC on a multi-monitor environment, Windows puts every Form on the "primary monitor"
by default, and that might not be what you want.
If the desktop got extended over all monitors (that's a checkbox per monitor),
and if the monitors are arranged such that they (almost) cover a true rectangle,
then it makes sense to validate a form's bounds (thats location+size) against
SystemInformation.VirtualScreen
You may want to have a closer look at the Rectangle type, in particular Rectangle.Contains().
If the desktop does not extend over all monitors, then I don't know how forms get
positioned on those non-desktop monitors. Feel free to tell me more about that.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi there,
this might be quite simple to do but i'm new to this, so what i would like to do is display the computers RAM as showing on the computer properties general tab, just under the processor info. i want to show as 512MB, rather than in bytes.
please help.
thanks
|
|
|
|
|
Hi,
these are the steps:
- get the size (you seem to do this with WMI), it will be a long 32-bit integer
BTW: I am C# programmer who prefers to use P/Invoke to call GlobalMemoryStatus()
in kernel32.dll, since I don't like WMI that much, it is slow for starters
- optionally: round it to a multiple of whatever seems appropriate
- divide by 1024*1024
- show it somehow (maybe as Label.Text)
You should get most of this working, then ask a detailed question if and when you're stuck.
-- modified at 17:47 Monday 6th August, 2007
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
What he said. (or she, just to be fair )
1024^2 turns out to be 1048576. What I did was take the straight value from My.Computer.Info.TotalPhysicalMemory and divide it by 1048576 and added Mb to the end. And there you have it.
|
|
|
|
|
Looks good, I forgot VB offers more info through My.Computer than the other CLR languages do.
BTW: I would not write 1048576 since that looks like a magic number, I really write 1024*1024
which meaning I trust is obvious for everyone, and is less error prone.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I usually assign a global variable to 1024^2, but I wrote this app before I started doing that (shortly after you posted your previous post )
|
|
|
|
|
What, in your opinion, is the best way to store/retrieve form sizes?
|
|
|
|
|
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I'm trying to have a form that automatically saves it's size and state. I've got the state part down, but I now need the size part. If anyone has ideas for a form location part I'm open for ideas? Robust code would be nice
|
|
|
|
|
you already are saving and restoring the state, whatever that may be (visible,
minimized, maximized, ... ?). But you ask about the size, which is just two numbers ?
Whatever scheme you have choosen, add a couple of lines to it, two to write a number,
and two to four to read and parse a number.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I get the following problem (probably because I didn't parse correctly):
Expression is a value and therefore cannot be the target of an assignment.
Is there a better way to do this:
Me.Size.Height = My.Settings.MainFormHeight ' I have a setting called MainFormHeight
|
|
|
|
|
OK, now I see your problem.
Form has Size property, and Size has a Height property,
both have getters and setters; nevertheless you can not change a Form's height by
doing Form.Size.Height=somevalue;
instead you should create a new instance of Size with the right values in the constructor,
then assign this to Form.Size
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Excellent! Works great! I can tell it to look at a variable too, right?
|
|
|
|
|
Sorry, I once more don't know what you mean by that. But probably yes.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
you should also be able to save the form size as a size value in settings as oppose to two seperate settings.
|
|
|
|
|
How do you disable rows in SQL using vb.net?
jds1207
|
|
|
|
|
Disable rows in a datbase table?? You don't. Using security in SQL Server, you can manage the access to the entire table, but not the individual rows.
|
|
|
|
|
like Dave said, there is no "built-in" method.
you can add a column to the table calling it "Enabled" or something and in your 'where' clause ask for all rows where Enabled=1
|
|
|
|
|
Well, I know you can do that sort of thing in a Janus GridEX by using conditional formatting. Maybe you can tell it to hide rows. I believe there is a trial version on the web somewhere.
It is possible you could mean columns, which is easy from a datatable in VB.NET.
If you really need to, use some special conditional formatting code and move the rows you do not want to a separate table.
|
|
|
|
|
I have a program that binds to a table that gets updated by another program. The table updates a dataset that is shown in a data grid. Each time a row is added to the table via the program, I want to grab that row and send it somewhere. How can this be done. Would I look at the table that is updated every 5 sec to see if changes (but changes could be deletes not Additions) or look at the dataset that I am filling? (Binding) Final choice would be using the data grid that I am using to display the rows.
Any Ideas? Thanks.
|
|
|
|
|
DataTable class offers 11 different events.
You do occasionally read documentation don't you ?
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi,
Use Dataset. But it is not advicable. But for over requirement, every time refresh the dataset(Dataset.Reset()) every time it will fill. N allow to load the datagrid. Use DataAdapter.
The DataTable is Very Good only for showing of DataGrid with diffrent Formats. But refreshing it is very tedious process and Non-Optimazation.
|
|
|
|
|
I've been working on a small function today that is confounding me to no end. I have a file that is one line, the file size is ~400k bytes, and is a list of items delineated by a '~'.
The funny thing is, I can see the data on the stream while viewing in the debugger, but the data doesn't get assigned to the variable, no matter what it is. (note: I've tried assigning to regular strings and to the stringbuilder class as well, without the Split() of course )
The errant piece of code looks like this:
<br />
Dim al as New ArrayList<br />
<br />
m_istream = New StreamReader(m_ipath)<br />
al = al.Adapter(m_istream.ReadToEnd().Split("~"c))<br />
I've tried this with much success on smaller strings(not streams), and I don't understand why this assignment isn't working. Could someone give me a hand please?
Thanks in advance.
Jason
P.S. I'm using VS 2003
-- modified at 13:40 Monday 6th August, 2007
"In the middle of difficulty lies opportunity." Albert Einstein
|
|
|
|