Using the same connection over many forms
Hi,
I'm writing a client-server winfroms application, I've notice that every
time I use the wizard to create a bound datagrid, I create a new
sqlconnection.
I wish to create one connection in the main form, and use it in the rest.
(b/c changing something in the connection string - like pwd user or db will
make me go over all the classes now, and find all the connections the wizards
creatred)
what is the best way to do it ?
Regards,
Dani Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77883
ANN: New Barcode Library from ComponentScience!
Announcement:
ComponentScience is proud to release Barracuda 1.0; our newest .NET
component library for Winforms, ASP.NET and the compact framework!
Use Barracuda to generate Linear, Postal, or 2-dimensional barcodes in your
ASP.NET, Compact framework, and Windows Forms applications. Barracuda 1.0
supports 27 different barcode symbologies with additional support for many
variations.
Creating barcodes with Barracuda is as easy as dropping a control on the
form, picking a symbology, and specifying the data to encode; but the real
power of Barracuda is in its ability to handle the most complex situations
you may encounter with certain barcode symobologies. For example, if you
need to use UCC/EAN-128 mode with the Code128 symbology, Barracuda makes it
easy.
An online demo is available at http://www.ComponentScience.net/Barcodes
For more information, please visit
http://www.ComponentScience.net/Elements/Barracuda
Barracuda includes:
- Support for multiple ASP.NET, Compact Framework, and Windows Forms in
one
package.
- Support for the following symbologies:
- Linear barcodes: Codabar, Code 11, Code 128, Code 13, Code 39, Code 93,
Coop 2 of 5, EAN13, EAN8, IATA 2 of 5, Interleaved 2 of 5,
Matrix 2 of 5, MSI, Pharmacode, Plessey, Standard 2 of 5, Telepen,
UPC A, UPC E.
- Postal barcodes: Australia Post, PLANET, PostNet,
RM4SCC (i.e., UK Royal Mail).
- Two dimensional barcodes: Aztec, Aztec Runes, Code 16K, PDF 417.
Maxicode and DataMatrix coming soon!
- Dynamic barcode image generation.
- Error correction support.
- Printing support.
- Full source code written in C# available. Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77882
ComboBox woes
I need help solving a couple of problems (and learning a couple of concepts)
involving ComboBox columns in my DataGrid.
The first problem involves my custom ComboBoxColumn class. I don't have
experience making custom classes so I downloaded some code. From what I've
read, it's pretty standard for adding a ComboBox column. It overrides the
Edit, SetColumnValueAtRow, and GetColumnValueAtRow subroutines.
It works great, but it doesn't allow the user to type in custom items in the
combobox. Anything you type in just gets ignored. I want users to be able to
add new items to the database through the comboboxes. I don't understand all
of this code, though, so I'm not sure how to do this. The comboboxes are
bound to datatables, so when the changes are committed I just need to add a
new row with the new text to the datatable. Then when my "Update Database"
button is clicked, the table changes will get sent to the database. It looks
like maybe SetColumnValueatRow is the key subroutine?
The second problem involves the relationship between my query form and my
display form. My query form is a series of ListBoxes bound to certain
DataTables in my DataSet. But before I fill the tables from the database, I
add an item called "All" to the tables so that I can select all items in the
listbox for query purposes. The problem is that the comboboxes in my datagrid
are bound to the same tables, so I have to remove the "All" item before
displaying the datagrid or else "All" will be displayed as a selectable item
in the combobox. This works fine if you use the query form once, but if the
user clicks the "Back" button on the display form I have to put the "All"
item back into the tables for use in the query form. But inserting an item in
a datatable that is already filled doesn't seem to be as trivial as adding a
row to a blank table. Obviously I want "All" to be the first item in the
list, so I can't just tack it on to the end. Right now I have to clear the
tables and refill them, which is taking about 15 seconds. I guess one
solution is to just make copies of the tables and put "All" at the first
index in one of them and bind each listbox and combobox to different tables,
but it seems there should be a more elegant solution. Is there a syntax for
inserting a custom item in a datatable at index 0? Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77878
Form.Closing event
Hello:
I have a Form that override the OnClosing method to make some actions before
the window is closed, but does not set the Cancel property to let the form
close, assuming that its value by default is false. All was working fine
until I install the service pack 1 of the .Net framework 1.1. The Cancel
property is true and the form remains open. I change my code to assign the
value to false, but I want to know if there is a reason for this behavior.
I check on a new application calling the Close(); method, or clicking on the
close button, and try also with the application main window and with another
window, modal and modeless, in all cases, Cancel property was set to false.
Somebody has an explanation? Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77877
Validating events not getting fired in TabPage
I have a TabControl with 5 TabPages. I made sure to set
CausesValidation to true everywhere possible. I put Leave and Enter
handles on each page which supposedly will fire each time I'm changing
pages, but for some reason it doesn't work. No events get fired. Has
anyone else encountered this?
Thanks Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77873
why are my arrow key presses not cought by my mdi child window?
hi all
i have an mdi child form.
i need to catch all key presses.
and indeed all key presses are cought,
however, the arrow keys are not cought.
why are my arrow key presses not cought by my mdi child window?
assaf Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77867
Problems running .NET apps on other machines
I'm fairly new to distributing .NET applications, and so far no one is able
to use the apps I create. They do run on all 3 of my machines. I include the
dotnetfxredist with the setup files. One person cannot even install the
framework from Windows Update. It's giving them errors and I'm unable to
troubleshoot over the phone. This pretty much blows since I've spent so much
time developing in .NET for my user base and they cannot use it! Is there a
way to convert my app to Windows executable or something? What are my
options?
-Max Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77866
Distinguish Home key from NumPad Home key?
Hi all,
Does anyone know if it is possible to distinguish between a user
pressing the dedicated Home key versus the Home key on the number pad
(NumPad 7 with NumLock off)? I'm working in VB.NET on WinXP Pro. The
standard KeyPress/Down/Up events return identical key codes. I've tried the
API GetKeyboardState call and I've even tried keyboard hooks as described in
http://www.developer.com/net/net/article.php/11087_2193301_1/
I'm able to accurately determine state of the NumLock key, but NumPad 7 with
the NumLock off appears to generate the same key code as the dedicated Home
key. Has anyone had any experience in this area? I've been looking at this
issue for a while, so it's possible I'm overlooking something simple :)
Thanks,
Jim Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77865
Application Restart or Reload Urgent....
Does anyone know how to restart an application from itself? Or is there a
way to completely reload an application form code simulating a restart?
Thanks in Advance! Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77864
How to manualy initiate the event?
Hi,
I would like to know if there in C# an equivalent to the
VB.NET RaiseEvent statement.
I would like to raise an event of a control in my code as
if the user's action provoked it.
Thanks,
Haim. Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77848
Panel backgroundimage disappear when EnableVisualStyle
I have a panel with a backgroundimage with a docked transparant label. If i
enablevisualstyles the backgroudimage disappear.
Any ideas why?
// Mats Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77846
Forms designer hangs when control added (combobox or listbox so far)
hi.
i've searched everywhere for an answer to this problem, and the closest
thing i've found is a report from someone else with the same problem.
using vb.net, ver 2003. this happened before installing the latest .net
framework update and after.
i have a simple windows forms app. a couple of forms, using textboxes,
tabgroups, labels, and buttons...nothing complex.
i try adding a combobox control to this form, and the IDE hangs
indefinitely (need to end task it).
the first time i had this problem was a couple of months ago with a
larger, more complex application... i had created some custom controls
that inherited from some of the base windows.forms controls, and was
having all sorts of fun with the designer not being able to "get it",
refusing to render forms, hanging if it did manage to open a form, and
so on.
the visual inheritance problem was easily fixed by simply building the
project, though i still had to be careful what controls i selected on a
form in design time in case it hung.
since then i've tried to do as much "visual" stuff as possible in the
code view, but i've encountered this again and can't get to the bottom
of it.
i've just run another vs.net process and attached the debugger to my
hanging one. i've noticed that the hanging occurs when i move the mouse
off the form (say, over to the properties dock) but having said that
i've previously noticed that the hang happens after a small period of
time, no matter what you do with the mouse.
so yeah, i've got a nice bit of disassembled code that's stuck in a
loop, details:
Address:
System.Windows.Forms.NativeWindow.Callback
(^this is what's looping)
it calls:
System.Windows.Forms.Message.Create
returns to NativeWindow.Callback, then calls:
System.Windows.Forms.Design.ControlDesigner.ChildSubClass.WndProc
which calls:
System.Windows.Forms.Design.ControlDesigner.get_DesignerTarget
System.Windows.Forms.Design.ControlDesigner.set_DesignerTarget
does anyone have any ideas? any pointers in the right direction would
help a lot! TIA :-) Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77845
howto put a Byte Stream directly in a picture-box?
Hi,
In my application I receive a Byte Stream (Dim bytFile() As Byte) which
contains a jpeg-picture, which I want to display in a picturebox.
I want to display it directly from the bytfile() without first writing it to
a file and than reading it. Does anybody knows how to do this?
I hae alreaddy a solution with writing it to a file, but the next time i
want to do it I get an exception that the file is still in sue when I want
to write to it. So to get aroudn this kind of problems I want something
without file...
My code with the file:
Dim strPicLoc As String
strPicLoc = "C:\test.jpeg"
'picture
RetStatus = EIDlib1.GetPicture(MapColPicture, CertifCheck)
Dim br As New BinaryWriter(File.OpenWrite(strPicLoc))
Dim bytFile() As Byte
bytFile = MapColPicture.GetValue("Picture")
br.Write(bytFile)
br.Flush()
br.Close()
br = Nothing
'show the picture in the picturebox!
picPicture.Image = Image.FromFile(strPicLoc)
Thanks a lot in advance,
Pieter Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77842
Tree control allowing multiple parents for a node (Graph)
Hi,
Does anyone know of a control that can display (and ideally allow
users to manipulate) a graph structure (similar to a tree structure,
but where a node can have more than one parent)?
This would be most useful!
Thanks,
Mark. Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77841
why are my arrow keys not responding?
hi all
i have a dot net form.
i capture all keyboard events.
everything works nice.
except for the arrow keys.
which are completerly ignored.
when writing a brand new application from scratch,
i am able to capture all keyboard events
including arrow keys.
but in my big application,
they are ignored.
what could be causing this effect?
assaf Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77838
Improved NumericUpDown control
Hi all
I am trying to implement an "improved" (silly users :-) NumericUpDown
control. This control is meant to display floating-point values and the
improvement consists in being able to mouse-select one digit of the FP
value and when pushing the up/down arrow, increment this digit.
The only solution I figured out so far (not implemented though) is the
"hardcore" way, i.e. trap the events to check which digit is selected
(yuck... variable size font ??).
Does anybody can think of an alternate way to achieve this ?
TIA
a+
Nicolas Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77836
Microsoft.VisualBasic.ChrW(13)
Is there another way to check for keyboard inputs?
I'm using the Microsoft.VisualBasic namespace:
e.KeyChar <> Microsoft.VisualBasic.ChrW(13)
I'm not sure but it seems to me that it is not the optimal way to use the
new .net classes and namespaces. is this correct?
Any sug? Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77825
Shockwave Player in Windows Forms?
There are plenty of posts regarding using a Flash player in standalone
Windows Forms apps, but what about the Shockwave player? I don't know
much about the differences between Shockwave and Flash, but I've been
told that you can do far more with Shockwave. Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77824
Crystal Report file comparing tool
Hi
I need Crystal Report file comparing tool I have over hundred reports
to see what changes between tow reports like Line objects position Text
objects text or font.
Is there any tool can do that.
Thanks in advance for help Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77802
Using the same components and controls in multiple tabs?
How can I use the same controls and components in more then 1 tab
collection?
The tab control covers the entire window. The different tabs are going to
contain some unique components and some common components. I do not want to
have repeat the common parts.
Thanks Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77801
detecting print preview
Hello
Can I determine (in the PrintDocument::PrintPage method) whether the page is
just previed or printed?
Thanks
Vaclav Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77799
Maintaining and Using App Login details
Hi,
I'm developing an Windows forms based app that will draw data from a SQL
Server 2000 system, that is set to use SQL Authentication (i.e. connection
string must pass uname:pword).
Given that various forms will need to use a SQL connection to generate data
for data grid's etc ... how can I pass this authentication information around
the various forms?
A solution is to start the application from a VB.NET class, that has a
shared member with the connection string (set once the user completes the
login)
Or create a shared connection object? Should I create a new connection
object for each form?
I currently test whether the login credentials are correct by enclosing
within a try..catch clause an attempt to open and close a connection, failure
will indicate invalid details (or perhaps a dead SQL Server!) ... any
improvements on this?
I assume that when using the form designer in VS.NET that if I manually
program the connection (i.e. outside the section of code written by VS.NET )
that I can point the adapters/datasets etc. to the required connection.
There are a few questions here ... but I've not so far found any answers
here, on Google or elsewhere :( !
Thanks in advance for help Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77795
normal drag and drop behaviour
hi all
when i allow drag and drop from/to my textbox,
i expect that when i hover over a selected aread,
the cursor would turn into an arror,
instead of an I-Beam.
but this is not the normal behaviour.
i don't know how to make the textbox behave
this way.
all i want is my app to behave as any other app in the world behaves,
when i hover over a selected text area, the cursor
turns into an arrow.
how can i do this?
assaf Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77790
KeyUp event routing issues in Windows Forms.
I believe I have found a bug in how keyboard events are routed in Windows
Forms. I am not sure if this is a bug or how to work around it.
MessageBoxes (MessageBox.Show) that are opened over top of a form end up
routing their KeyUp events to the active control beneath the messagebox.
For example, if I have a TextBox control focused on a form, and I open a
message box, pressing "enter" to close the message box causes the TextBox
control to receive a KeyUp event for the enter that was pressed in the dialog!
It's almost as though the message is getting routed to the incorrect location.
To reproduce this problem, create a new Windows Application (C#) project in
Visual Studio 2003 (.NET 1.1. The issue occurs in the service pack edition as
well).
Drop a TextBox control onto the form's canvas from the toolbox. The bug
occurs in any control that can receive focus, but in this case I will use a
TextBox.
Add a MouseUp event handler to the textbox with the following code:
private void textBox1_MouseUp(object sender,
System.Windows.Forms.MouseEventArgs e)
{
MessageBox.Show("The textbox was clicked. Pressing 'enter' on this
dialog will cause the keyboard event to be incorrectly routed to the text
box.");
}
Then add a KeyUp event handler to the textbox with the following code:
private void textBox1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs
e)
{
if (e.KeyCode == Keys.Enter)
{
MessageBox.Show("An Enter KeyUp event was received by the text box.
If you pressed enter to close the dialog, this message was incorrectly
received! Pressing enter again on this messagebox will cause an endless
loop!");
}
}
Save the project and then run the application. Click on the textbox to cause
the messagebox to appear, then press the enter key while the messagebox is
focused. The KeyUp event was routed to the wrong location, possibly causing
undesired behavior!
I noticed this bug with we were writing "ESC" key handling code in our
application to close documents. A messagebox would appear, and if the user
pressed "ESC" to close the messagebox, the ESC key event would get routed to
the document, which would cause it to close - definately not correct
behavior! :(
I don't have the KeyPreview property enabled on the form. Is there any work
around for this? KeyPress and KeyDown don't get executed however. I suppose I
could move the code into the KeyDown event. Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77785
SelectedIndexChanged event in comboA causes same event to fire in comboB
I have a vb.net 1.1 winforms app and have several combo boxes on a form 2
combos have the same data and are populated from the same data table using
the bind method. One is the ShipToAddress and the other is the
BillToAddress. when the user selects an address in the shipto combo, after
its SelectedIndexChanged event fires, the SelectedIndexChanged event fires
in the BillTo combo which, of course, is causing big problems.
Why is this? is it because they are bound to the same data table? Is it a
bug in vs 1.1? Can anyone recommend a fix or work around for this?
Thanks.
--
moondaddy@nospam.com Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77784
capturing windows forms appearence?
the print screen button in the keyboard can save what shows in desktop
into clipboard (the alt + prtsc does the same thing for the topmost
window)
i want to see if windows forms' control can save its appearence into a
bmp file. i guess in OnPaint method we can do something? Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77783
Form with background transparency issues
Recently I wanted to create a small little program that could sit=
on the desktop and not block the desktop wallpaper=2E There are=
two methods to accomplish that ( that I am aware of )=2E
1) create a bmp as a background image and set the transparency=
key to match its color
2) specify the form's background color with a matching=
transparency key
Now my issues with both methods, but first it should be known=
that I have set the forms to have no border or title bar and=
have implemented code that allows me to click-and-hold anywhere=
on the form and move it=2E The data actually displayed on the=
form is just text and one rectangle, all drawn by me ( there are=
no controls on the form itself )=2E
1) I have two issues with this method, although it is what I'm=
prefering to use at the moment=2E The first seems to be the=
discrepancy between how the program is handled when the=
computer's Color Depth is 32bit or when it is less than 32bit (=
16bit )=2E When the color depth is 32bit then I am able to click=
on the entire area the form inhabits ( even that which is=
transparent ) and move it, but if the color depth is less than=
32bit ( 16bit ) then only the drawn text or rectangle outline (=
since it has no fill ) can be clicked to drag the program=
around=2E Clicking on the transparent areas just passes the click=
through the form to whatever is below ( even when I know the=
form has focus )=2E I'd like to be able, regardless of the=
desktop's color depth, to click anywhere within the form area=
and move the application=2E
The second issue I have with this method occurs when I take my=
executable and put it on another PC ( my PC is XP Pro, the other=
PC is XP Home=2E=2E Both SP2 )=2E The problem is similar, but a=
little different=2E When the 2nd PC's color depth is at 32bit,=
the transparency does not work=2E The green/lime ( that's the=
transparent color I'm using ) background shows=2E Needless to say=
this is not acceptable=2E When I change the color depth to less=
than 32bit ( 24bit this time ), the transparency actually works,=
but I come across the same issue of clicks on the transparent=
areas just passing through=2E
2) With this method I have not tried it on a 2nd PC yet ( I don't=
have it available where I am atm )=2E Its basically the same=
"issue" as mentioned above with color depth less than 32bit,=
except it does it with a color depth of 32bit and 16bit=2E Clicks=
on the transparent areas just pass right through=2E I'm tempted=
to just go with this method and possibly make one area on the=
form that is meant to be used to drag it around ( similar to the=
idea of the box that appears to move tables in MS Word ), but=
I'm hoping there's a solution I'm unaware of before I do that=2E
Anyways, all of this brings up some interesting questions=2E
-What does color depth have to do with transparency handling?
-Does the version of XP ( Home or Pro ) handle transparency=
differently?
Probably some more questions also=2E
Not sure if it matters, but I'm doing all of this in C#=2E
Any help or suggestions offered will be greatly appreciated=2E
--------------------------------
From: othell m=2E
-----------------------
Posted by a user from =2ENET 247 (http://www=2Edotnet247=2Ecom/)
<Id>n5f4+mRIPU647s2eV3QftA=3D=3D</Id> Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77780
No Touch Deploy not working on Windows 98
Our No Touch Deploy application has worked on all OS's thus fire (post
Windows 98).
We just installed our stub exe (the one that pulls the assemblies from a web
server) on a Windows 98 machine.
I ran the stub (all it does is an assembly.loadfrom pointing to a url) and
got all kinds of strange thread exceptions.
I looked in the assembly|download folder and it's empty.
Anybody had any experiences with NTD and windows 98?
Greg Robinson
Custom Data Systems, Inc.
www.cds-am.net Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77779
ComboBox Row Source = Result of DB Query?
I have an access database and I want to populate a combo box with the
contents of a Table in my access database. What is the best way to do
it? I was trying to do it at design time, but not sure if it can be
done. Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77778
processing of windows messages during long operation?
Hi,
My code has a long operation to do, and I want to let other windows messages
be processed whilst I do that operation. Casting my mind back 10 years, I
can't remember the call to do this.
Can some one tell me the answer?
Thanks
Martin Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77775
Testing Internet connection?
In a Library or Win Forms application how can my code test whether the
computer is connected to the Internet? (The computer could use a dial-up
connection or it could be on a network.)
TIA Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77773
Pass DataSet to Modal Form
I have built a main form that creates and fills a dataset. I want to open a
modal form and pass it one of the tables in the dataset but I don't know how
to code it in VB. Does anyone have an example or point me in the right
direction to find some code?
thanks Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77772
Source for multi-track editor?
Hi,
I need to build a testing scenario generator that will create binary
messages for an application we have built. The UI would look like a
movie editor in that it would have parallel timelines for the actions
of several people and several machines. The user would be able to
lay down action icons on the timelines to show what was going on at
any given time and specify the some properties of the action. At some
point the user could click <Make Scenario> and all the corresponding
input for testing would be generated.
What I'm wondering is anyone knows of some source code in C# for a
similar kind of editor that might serve as a starting point. Even a
custom timeline control that could be replicated would be a good help.
Thanks! Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77766
Disable Task Manager
I'm trying to figure out how to PROGRAMMATICALLY disable the Task Manager
while logged in as a "non-administrator" user (only belongs to the "Users"
group).
I know I can programmatically disable the Task Manager by having my app
write a 1 to the registry key
HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System.
Unfortunatley this only works, though, if the user who is running the app is
logged in as an Administrator. When I try to run the app as a just a regular
"non-administrator" User I am not able to write to the registry!
So... Is it possible to do this? If so how? Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77765
Detecting idle time from a .Net application
I'm having a lot of trouble finding a universal and stable solution to the
problem of detecting a session's idle time. I have a .Net application that
runs in the system tray, much like many of the messenger services out there.
From what I've read in the newsgroups, there are several mechanisms that I
can try, but the biggest problem is that I have to get it working on Win98,
WinME, Win2K and WinXP.
The options I've found are:
1) On a timer, use GetLastInputInfo to check the last input event
No good. This requires Win2K and up - I need to run on 98 and ME
2) Add a low-level mouse and keyboard hook in my .Net application using
SetWindowsHookEx specifying the hooks WH_MOUSE_LL and WH_KEYBOARD_LL
Again, works great in XP, but WH_MOUSE_LL and WH_KEYBOARD_LL are
incompatible with 98 andME
3) Add a global mouse and keyboard hook in an external DLL using
SetWindowHookEx and WH_MOUSE and WH_KEYBOARD
This work fine accross all platforms, but for some reason whenever the
screensaver kicks in, my hook stops receiving events.
So my question is, is there another solution I should try, or is there
something I should be aware of that could get any of the above solutions to
work? Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77764
delete selected rows from a datagrid
I have a datagrid whose datasource is a datatable. I want the user to select
(multiple) rows in the datagrid, press a button and have the selected rows
deleted. Iterating through the rows in the datagrid and testing to see if
each is selected and then deleting the associated datarow from the datatable
is probably inefficient but nevertheless doesn't work because the selected
rows in the datagrid are reset as soon as the first record is deleted from
the datatable. Is there an obviously correct method for doing this? Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77763
Newbie: Dataset - ComboBox synchronization
Hello,
I have two questions involving Datasets and populating ComboBoxes and other
controls with them.
1) Two cmbboxes are populated by two different fields of the same table and,
of course, synchronized. However the second field is not required in the DB
and missing contents sometimes.
Ex:
Field1 Field2
john 1990
mary
paul
anna
mario 1967
james
.....,etc.
So when the user scrols through cmbField1 there is no problem, however if
you want to scroll through the year there are big gaps that you go through
because there is no contents there. Is there a way to get around that and
STILL keep the cmb Boxes synchronized?
2) Now, after having the above from the same table and trying to get
*Related* info from another table in my DB (of course still synchronized
with the other two controls) I added a second table to the dataset with the
INNER JOIN info. I access the new field by : Table1.field3. But field3
belongs to Table2 !!! not Table1! Is this normal?
People say it's not a good idea to add more than one table in the same
dataset. If this is true how can I get Relational information that is still
synchronized? (i.e. fields 1 and 2 from Table1 and field 3 from Table 2)
The fact that I get what I want is not enough. I need to know if it's the
right way for my case and if there is s better way.
Any help/feedback would be Greately appreciated.
_steve_ Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77762
Combo Box Display Member is reset
Context: setting a collection of business objects as the DataSourceof a
ComboBox. The collection itself extends CollectionBase, and has public
properties exposing the desired display and value members. In this particular
case, the display and value member is "Value".
Prior to setting the combo box datasource, the display member and value
member properties are set, then the datasource itself is set. So, before
setting the DataSource, the DisplayMember = "Value", but after setting the
DataSource, the DisplayMember reverts to "".
To put a twist on the issue, the second time that the DataSource is set,
everything works as it should...
Thanks for any and all input.
-- Sancerre Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77758
User Control
Hi All,
Can I use user controls at windows forms???
if yes...
Where I must search about it??? Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77756
user control ?!?!!?! basic questions ...
Hi All,
Can be user controls used in winforms ?
if yes...
Anibody knows how can I find any article about user controls to winforms... Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77755
How to: Programactically set the computers clock to the official time?
My computer seems to loose seconds from day to day so I would like to have
my app download the official time and set my computer's clock. What's the
best way to do this? Is there an official time website that offers a library
for getting the time? Any thoughts?
Steve Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77754
how to run Excel menu options when shown inside a webBrowser control ?????
hi all !!!
I have a WinForms app that has a Internet Explorer component where I show
information by using the "navigate" method.
when I show an XLS file the Excel is embedded and the spreadsheet is
correctly shown; the Excel menues are not displayed (that's fine).
what I would like to do is to add a button in my WinForms application to pop
up Excel's "Save as" dialog.
is there any way to do it ? (remember that the XLS file is shown inside
the webbrowser component)
any hint will be greatly appreciated.
thanks in advance,
ant Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77752
MSComm doesn't fire OnComm event in a User Control
Iâ??m developing a user control (in C#) that encapsulates the MSComm control.
MSComm control is available as a COM component. So, Visual Studio.Net
automatically prepares an Interop wrapper for this component.
I want to use my user control in a C# windows application. Iâ??m able to send
the data through this user control. But the problem is that my user control
doesnâ??t catch the OnComm event.
Iâ??m sure that there is no problem with the settings of MSComm control. This
is because when I put an MSComm control in a separate windows application and
then tried to catch the OnComm event, it worked fine and I got all the data
from the Input property within the event handler.
To Summarize:
MSComm control doesnâ??t fire OnComm event in a User Control application.
MSComm control does fire OnComm event in a Windows application.
Problem:
I want to catch OnComm event in my User Control Application. Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77750
Terminal Service: conocer la IP del cliente remoto?
Utilizando .Net, como puedo obtener la dirección ip o el nombre del cliente
remoto que está conectado por Terminal Service a un Servidor de Terminal ?
En el Terminal Servide Manager me muestra el nombre del cliente remoto, o
sea del equipo remoto, pero no se como obtenerlo utilizando C# .Net.
gracias. Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77746
How to add ListBox as Row of DataGrid
Hi Guys,
How to add ListBox as a row (Sub row) of DataGrid...
Please help me
Tushar P.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.766 / Virus Database: 513 - Release Date: 17-Sep-04 Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77744
Problem with Creating User Profiles on Windows XP
Hi all,
Please ignore the other post.. The cat jumped on the machine and sent it
before I could stop it!!
Was wondering if anybody has expericence this problem..
I am writting an application in C# using windows forms, to create windows
user profiles and then updating the registry information for the new
profiles.
I have managed to create the user successfully and thought that I was
writting the registry information correctly.
That was until I checked the 'C:\Documents and Settings' Directory, when I
noticed that the new users directories did not reflect their names. But
instead comprised of non printable characters!!!
Here is the code sample in C#
//////////////////////////////////////////
DirectoryEntry NewUser;
DirectoryEntry AD = new DirectoryEntry("WinNT://" + Environment.MachineName
+ ",computer");
// delete user when existing
try
{
// this throws when no such user
NewUser = AD.Children.Find(strNodeName, "User");
MessageBox.Show("User already exists!!");
return;
}// Catch not found exception
catch(COMException cex)
{
Console.WriteLine(cex.Message);
}
// Add user using the user schema
NewUser = AD.Children.Add(strNodeName, "user");
NewUser.Properties["description"].Add(this.txtFirstName.Text + " " +
this.txtSurname.Text);
// NewUser.Properties["PasswordExpired"].Add(1); // user must change
password at next login
// Set user flags sample here sets Account disabled, pwd can't change
// this flag is different for LDAP accounts
NewUser.Properties["userFlags"].Add( UF_NORMAL_ACCOUNT |
UF_DONT_EXPIRE_PASSWD );
// invoke native method 'SetPassword' before commiting
// for AD domain accounts this must be done after commiting
NewUser.Invoke("SetPassword", new Object[] { this.txtPassword.Text });
NewUser.CommitChanges();
// Add user to guests alias
DirectoryEntry grp = AD.Children.Find("Guests", "group");
if(grp.Name != null)
{
grp.Invoke("Add", new Object[] {NewUser.Path.ToString()});
}
MessageBox.Show("Account Created Successfully");
AD.Close();
//////////////////////////////////////////
Then I proceed to update the users Registry information!!
At this point their is no Directory for the user in "C:\Documents and
Settings\" directory
//////////////////////////////////////////////////
NativeMethods._PROFILEINFO profile;
IntPtr hToken = IntPtr.Zero;
hToken = NativeMethods.CreateLogonToken(UserAccount, UserDomain,
UserPassword);
if(hToken != IntPtr.Zero)
{
profile = new NativeMethods._PROFILEINFO();
profile.dwSize = Marshal.SizeOf(profile);
profile.lpUserName = UserAccount;
// Directory Still Not Created at this Point!!
int ret = Win32.LoadUserProfile(hToken, ref profile); // This function
Invokes
if(ret != 0)
{
// Use WMI to get the SID of the user (this requires W2K3 or XP)
using (ManagementObject account = new
ManagementObject("Win32_UserAccount.Domain='" + UserDomain +"',Name='" +
UserAccount + "'"))
{
account.Get();
// Get key wich is the root for the users hive loaded in HKU
UserSID = account["SID"].ToString();
if(UserSID.Length != 0)
{ // Now update the registry information for this user!!
UpdateRegistryInformation();
}
}
ret = NativeMethods.UnloadUserProfile(hToken, profile.hProfile);
}
}
[DllImport("advapi32", CharSet=CharSet.Auto, SetLastError=true)]
static extern int LogonUser(string lpszUserName, string lpszDomain, string
lpszPassword, int dwLogonType, int dwLogonProvider, ref HANDLE hToken);
[DllImport("userenv", CharSet=CharSet.Auto)]
internal static extern int LoadUserProfile(HANDLE hToken,ref _PROFILEINFO
lpProfileInfo);
public static HANDLE CreateLogonToken(string name, string domain, string
passwd)
{
HANDLE ret = IntPtr.Zero;
HANDLE tok = IntPtr.Zero;
System.Management.ManagementObject mo = new
System.Management.ManagementObject(new ManagementPath());
mo.Scope.Options.EnablePrivileges = true;
int result = LogonUser(name, ".", passwd, LOGON32_LOGON_INTERACTIVE,
LOGON32_PROVIDER_DEFAULT, ref tok);
if (result != 0) // If success
{
ret = tok;
}
else
{
string temp = "LogonUser Error: ";
temp += Marshal.GetLastWin32Error().ToString();
MessageBox.Show( temp );
}
return ret;
}
///////////////////////////////
So I stopped writting to the registry information and then physically logged
in as the user via the windows login screen.
This then created the directory correctly!!
Any ideas?
Thanks
Wayne Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77743
how to prevent duplicated in combobox....
How do i prevent duplicated in combobox ?
Private Sub ComboBox1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles ComboBox1.KeyPress
If Asc(e.KeyChar) = Keys.Enter Then
AxWebBrowser1.Navigate(ComboBox1.Text)
Dim bFound As Boolean
bFound = False
For i As Integer = 0 To
ComboBox1.Items.Count - 1
If ComboBox1.SelectedItem = ComboBox1.Text Then
bFound = True
Exit For
End If
Next
If bFound = False Then
ComboBox1.Items.Add(ComboBox1.Text.ToString)
End If
End If
End Sub Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77738
CollectionEditor
Hello everybody.
How can I call CollectionEditor from the code, not by click on visual
buttons in PropertyGrid?
I suppose I have to inherit UITypeEditor, set my custom CollectionEditor as
default CollectionEditor for my Collection, override EditValue method and
call EditValue?
Can anybody send example?
Max Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77737
How to display the Progress (%) in the middle of a Progress Bar...
Hi Everyone
Can anyone tell me how can I display the progress in percentage in the
middle of the progress bar with "invert color" using VB.NET, this is very
common and available with most of the applications, like
at the begining the text "0%" is shown in black text and the background
color of the progress bar is white
and at the end, when the progress bar is filled with blue color then the
"100%" text is in white color
when the progress is in the middle that is "50%" then "5" appears in white
color and "0%" appears in black color
I want to have this type of effects
Thanks Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77734
Flexible layouts with WinForms
I´d like to know if there is something like GridBagPanel under Java in
WinForms. I have to organize controls in my dialogs flexible. The
Dock/Anchor-Stuff is not enough for me.
Can you help me?
Thorsten Tag: Is there a way to lock columns on a datagrid so that they don't sc Tag: 77733
when the scroll bar is moved while allowing the other columns to scroll.