Controling forms datasorse through vb Hi all I'm working on a form in Access, I have a list box and a calender, I would like to set up the list so that its table query is linked based on the calendar. When I like on the calendar I would like the list to display only entries that correspond to the months selected in the calendar, Help would be much appreciated. G Tag: Windows Forms General ToolStrip problem Windows Forms
MouseUp-Event doesn't work correctly for the ListView using Visual Studio 2005. The OnMouseUp-Method or the MouseUp-Event is fired correctly, when the mouse cursor is within the area of the ListView-Control. But when I hold the mouse button and then loose the button outside the control it is not fired. Then when I move inside the control again with the cursor suddenly it is fired. Other controls like the listbox or the datagridview does not have such a strange behaviour. Is there a workaround Ok, it would be no problem to prevent from the MouseUp event when I move into the control range again (with MouseEnter and MouseLeave). But that is not my problem. I need the MouseUp-Event to the right time even when the mouse is out of the control area. Thanks in advance! Tag: Windows Forms General ToolStrip problem Windows Forms
Code After load Hi, I'm loading a form that loads a lot of data from a server app. this causes the application to wait with displaying till all the data is loaded. I am looking now to load the data after the form us fully loaded. is there a way to do that like makign an new event called after_Load instead of Load. Thanks Tag: Windows Forms General ToolStrip problem Windows Forms
How can I make WebBrowser and AxWebBrowser the same thing. this .webBrowser1 = new System.Windows.Forms. WebBrowser ();
this .axWebBrowser1 = new AxSHDocVw. AxWebBrowser ();
I have to have two forms and I need them to be one. One has one the other don't Same with other. I don't know how posable it is but what way could I get around this Tag: Windows Forms General ToolStrip problem Windows Forms
Load and resize image Obviously, I know how to load an image from a memory stream ( which is what I have on hand in this instance ), and I know how to resize it. What I want to know is, if I have a memory stream that represents a 4092x4092 PNG, does any method exist where by I can create a 1024x1024 ( for example ) copy of this image without having to have enough memory to hold the full size image as part of the process
Thanks
Christian Tag: Windows Forms General ToolStrip problem Windows Forms
How to stop application execution before installation completes? Hi I have created installation for a small desktop application using setup project. Application is in c# and Ms-Access.My problem is Application starts before installation completes and installation stops in between. After my closing application, installation completes. How to stop this thanks. Tag: Windows Forms General ToolStrip problem Windows Forms
How do I update the changes from my DataGridView into my Access Table Dear All,
I have a edit button in m form and when i press it, it will ask for which record you want to edit. After inserting the correct record in that Input Box it will move to the records and allow me to edit. The other rows then are read only. I am being able to edit the row. but whenever i press the ok button to update the records in original access table, its updating the data but showing an error message in the following Red line of my code snippets:
Code Snippet
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Data.OleDb; using System.Windows.Forms;
namespace CSAccess { public partial class Form1 : Form { public Form1() { InitializeComponent(); }
OleDbDataAdapter da; DataTable dt = new DataTable();
private void Form1_Load(object sender, EventArgs e) { string strQuery = "Select * from Product"; da = MainDA(strQuery, "Select");
da.Fill(dt); dataGridView1.DataSource = dt; }
private OleDbDataAdapter MainDA(string Query, string Mode) //================================================================== { string strConn = @"Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C:\MyDB.mdb;"; OleDbConnection conn = new OleDbConnection(strConn); OleDbDataAdapter DA = new OleDbDataAdapter(Query, conn);
//....Select Statement. if (Mode == "Select") { //....Set SelectCommand Properties: DA.SelectCommand = new OleDbCommand(); DA.SelectCommand.Connection = conn; DA.SelectCommand.CommandText = Query; DA.SelectCommand.CommandType = CommandType.Text;
DA.SelectCommand.ExecuteNonQuery(); } //....Update Statement. else if (Mode == "Update") { //....Set UpdateCommand Properties: DA.UpdateCommand = new OleDbCommand(); DA.UpdateCommand.Connection = conn; DA.UpdateCommand.CommandText = Query; DA.UpdateCommand.CommandType = CommandType.Text;
DA.UpdateCommand.ExecuteNonQuery(); }
return DA; }
private void cmdOK_Click(object sender, EventArgs e) //=================================================== { grdData.BeginEdit(true); string strSET, strWHERE, strQuery, strTable; strTable = "tblProduct"; string strSearchString = "BISWA4B";
strSET = " SET fldID = '" + grdData.CurrentCell.Value.ToString() + "'"; strWHERE = " WHERE fldID = '" + strSearchString + "'";
strQuery = "UPDATE " + strTable + strSET + strWHERE;
da = MainDA(strQuery, "Update"); dt.DefaultView.AllowEdit = true;
grdData.Refresh(); OleDbCommandBuilder cmd = new OleDbCommandBuilder(da);
da.Update(pTable); //***Eroor occuring dt.AcceptChanges(); this.Close(); } } }
Suppose, I want to edit the Column where ID "BISWA4B" and i changed the string to BISWA. The code is giving an error message at the red line. Though the database has been updated. Can any body help regarding this issue.
Regards,
Biswajit Tag: Windows Forms General ToolStrip problem Windows Forms
Retrieve Object from ListBox I've got a OleDBDataReader object whose values I want to store in a ListBox for user interaction. The values I'm storing in the ListBox are the users first and last name (this is the displayed values). And I'm storing in the ListBox the users Social Security Number. I have done this by way of creating an object: class ListBoxStorage { public object data; public string display_string; public ListBoxStorage(object data_stored, string display_val) { data = data_stored; display_string = display_val; } public ListBoxStorage() { display_string = "Empty String"; } public override string ToString() { //MessageBox.Show("User " + display_string.ToString() + ", has the SSN of: " + data); return display_string; } } This object is then used to add data to the ListBox: ListBoxStorage temp_var = new ListBoxStorage(); temp_var.display_string = response["first_name"] + " " + response["last_name"]; temp_var.data = response["ssn"]; results_list.Items.Add(temp_var); The class idea worked
flawlessly. I can now see that I have stored an object in the ListBox
object. And it displays what I've told it to by way of the ToString()
method. Great! My problem is that when I use the MessageBox.Show(((ListBoxStorage)results_list.SelectedItem).data.ToString()); It
always is returning the value that was last input into the ListBox.
For instance; the last client put into the ListBox has the social of
589778888. I put an event on the results_list that when the selected
index changes that I call the above snippet of code. No matter what it
always returns 589778888. And just as a check to make sure
that the right ssn are being stored with the right User names in my
ListBoxStorage class whenever ToString() is called it throws out a
MessageBox with both the username and the ssn and they match perfectly. Some how my selection index isn't changing properly or something to that affect. Tag: Windows Forms General ToolStrip problem Windows Forms
Would this be an ok way of initializing a child window? Code Snippet
private void OpenWindow(Object Formname)
{ Formname ObjWindow = new Formname(); ObjWindow.MdiParent = this; ObjWindow.Show();
}
private void fclsParent_Load(object sender, EventArgs e)
{
this.ObjWindow(FclsChild);
} Tag: Windows Forms General ToolStrip problem Windows Forms
NotifyIcon poping up a micro-window Hi everyone... I was looking in the forum some issues about NotifyIcon tool, but I can't find some helpful about this little windows displayed by some programs like messenger when a new mail is in the inbox and something like that... I'm not sure if anyone else has asked for something similar... but: How can I send throw a NotifyIcon messages in a little window like a new mail or a new contact, like msn and others does Thank you very much..!! Tag: Windows Forms General ToolStrip problem Windows Forms
Paging in grid View control in C# Hi
Can any one one tell me how to implement Paging with a data grid view control
in Dot Net C# 2005 Tag: Windows Forms General ToolStrip problem Windows Forms
Adding a Rectangle object to a Panel I was able to add a button/label to a Panel like this; this.panel1.Controls.Add(this.button1); this.panel1.Controls.Add(this.label11); this works..OK!! But, what I need is to add a Rectangle object to a Panel. I draw a Rectangle object; Graphics graph = this.CreateGraphics(); Pen penCurrent = new Pen(Color.Red); Rectangle Rect = new Rectangle(300, 50, 150, 75); graph.DrawRectangle(penCurrent, Rect); But when i do like this; this.panel1.Controls.Add(this.Rect); it gives an ERROR! ----- Says; Controls.Add() , works only for System.Windows.Forms.Control and CanNOT work with System.Drawing.Rectangle ----- So how can i achive this; add a Rectangle object to a Panel Tag: Windows Forms General ToolStrip problem Windows Forms
Moving a Windows Form. Hi,
I'm trying to find some resources on how to do the following on a user's desktop;
A) OnLoad find out what windows objects currently exist on the user's desktop (thereby load in the correct location appropriately).
B) Move a window on the user's desktop. I.e., When the form loads I want it to slide in, not just appear).
I have not had any luck finding resources on the above, so if anyone has any ideas that would be great.
Thanks - Greg. Tag: Windows Forms General ToolStrip problem Windows Forms
System.Diagnostics.Process I am trying to use the System.Diagnostics.Process to execute an external utility executable. When I do the .Start() it is executed fine, but then does not return any data. When I run the utility on its own, I see a message in my command prompt. I need that data that it returns, any clues how I might be able to access it Tag: Windows Forms General ToolStrip problem Windows Forms
How to deselect the DataGridView row header Hi, I'm trying to figure how if it's possible to completely deselect rows, including the arrow symbol in the rowheader cell. The reason I am trying to do this is because with multiple selections (eg. using CTRL key) the user can select multiple rows, but they can also deselect previous selections. Example: - Select first 3 rows with CTRL key - Deselect 3rd row with CTRL key. The SelectedRows collection correctly reflects the change, and now contains only the first 2 rows. Also, the CurrentRow.Selected = false for the third row - But the RowHeader arrow is still on the third row, which is now no longer selected - What I would ideally like is to set the new CurrentRow to be the second row, and the RowHeader to be updated accordingly I have tried the following: DataGridViewSelectedRowCollection selRows = _dataGrid.SelectedRows; bool selected = _currentRow.Selected; if (selRows.Count > 0 && !selected) { //Get index of last row in selRows collection RowIndex = selRows[selRows.Count - 1].Index; //The following call results in selRows being cleared and only 1 row being //selected _dataGrid.CurrentCell = _dataGrid.Rows[RowIndex].Cells[0]; } but it does not do what I need. Any suggestions would be greatly appreciated. Thanks Mauro Ciaccio Tag: Windows Forms General ToolStrip problem Windows Forms
C# - ListView Hi...
In my ListView code i have 10 rows & 10 columns. I want to search 1 word say "Search" in a perticular column(& all rows) & then if i have that word in that column then only i have to select that perticu;lar row or else i have to delete that row from completely ListView .
(e.g. I am searching for word "search" in column 5 & i found that word in row no. 1 , 3 , 5 , 7 then on my form i have to display only 1 , 3 , 5 , 7 rows of that ListView)
How i can do this in C#...
Thanks ,
Vinay Tag: Windows Forms General ToolStrip problem Windows Forms
How to catch the event when user clicking outside of a dialog box Hi there,
I have a MainForm opens a child form as dialog box (eg: ShowDialog() ). If user click anywhere outside the dialog box, I would like to catch that event and close the dialog box. Anyone knows how to do it Your help will be very appreciated.
BR,
L Tag: Windows Forms General ToolStrip problem Windows Forms
need help with Datagrid's Captiontext hi, I want the captiontext of my datagrid to display the data of the cell I selected, I tried alot of ways and search throughout the Internet but no avail. My project was passed down and the older version is able to display the selected cell's data into the captiontext of the datagrid, but its done by configuring the properties of the datagrid in design view instead of coding. Can this be done by coding I am truly grateful for your help
P.S.: Its my first time here, so if I had posted the topic onto the wrong forum, please forgive me! >.< Tag: Windows Forms General ToolStrip problem Windows Forms
Typed dataset memory leak or mistake made in programming? Hi there.
I'm currently working in a system that uses typed datasets to represent business entities.
We have quite a few batch jobs that are intended to run at certain times during a day.
Some of these batch jobs are handling quite a lot of data and are running for more than 24 hours at a time. The problem is that we run out of memory from time to time.
It seems to be related to how the CLR handles typed datasets. I have made a small app to reproduce the behaviour.
I'm running the test app in VB.Net 2.0 on a Windows XP x86 machine (3GHz, 2,5 GB RAM) .
The test app is a simple console application that iterates 20 times. Each iteration does 1000 Threadpool.QueueWorkItem.
Each workitem loads 3 typed datasets with approx 70kB XML-data each and then does a dataSet.Copy on each of the 3 datasets (just to emulate some memory consumption) and then does a Thread.Sleep(200) to simulate some execution waiting time.
gcServer is set to "true" to run server garbage collection.
When I run the app and look at some perfmon counters i see the following:
(.Net CLR Memory)
# GC Handles are increasing linearly and never decreases.
# Bytes in all heaps are increasing and have a few "dips" during GC but the overall trend is an increase.
Gen 0 heap size are fairly stable
Gen 1 heap size are fairly stable
Gen 2 heap size are increasing and have a few "dips" during GC but the overall trend is an increase.
(Process)
Private bytes are slowly increasing and never decreases
When I replace the typed datasets with untyped ones, the picture is totally different.
(.Net CLR Memory)
# GC Handles bumps up at each iteration (when queueing the workitems) and decreases as each workitem is done (as it should be).
# Bytes in all heaps are fairly stable.
Gen 0 heap size are fairly stable
Gen 1 heap size are fairly stable
Gen 2 heap size are fairly stable
(Process)
Private bytes are fairly stable
Any ideas
Regards
Patrik Tag: Windows Forms General ToolStrip problem Windows Forms
How to add Merge Module Install Condition ? Hi,
I am facing problem on Merge Module Install Condition.
there is no property to set Merge Module Install Condition.
In my installation i have put two selection box. 1. server 2. client
If user select server then only installer should install merge module.
But here merge module is also install for client.
I can put condition for other files and its works fine but I am facing problem in merge module
Need help please.
Thanks Tag: Windows Forms General ToolStrip problem Windows Forms
Read and write *.csv File How can i read *.csv file and import data in database also read data from database and write in *.csv file Tag: Windows Forms General ToolStrip problem Windows Forms
DataGridView Combobox Refresh/Update - VB.NET 2.0 I have an unbound datagridview with three comboboxes (e.g. A, B, C) All three comboboxes share the same datasource and use the same valuemember. If I change the value of say combobox A, then B and C change also.
My problem is that B and C do not show the update until after I click off of combobox A. I want B and C to update as soon as I make the selection on A. How do I do this Tag: Windows Forms General ToolStrip problem Windows Forms
MonthCalendar control set DisplayRange Hi, Can anyone please let me know how to set the DisplayRange of the MonthCalendar control of .NET 2.0. There is a method MonthCalendar.GetDisplayRange(bool) but am not able to find a way to set the DisplayRange. Best Regards, Tag: Windows Forms General ToolStrip problem Windows Forms
Access to VB.NET 2005 treeview growing pains I'm an Access programmer trying to move my VBA programs over to VB.NET 2005 and I'm having trouble learning the new controls. In Access I have a treeview control populated from a SQL table at run time. My database looks like this:
ID
Name
Hierarchy
Parent
2
Laser Printing
1
0
3
Cut Sheet Simplex
2
2
4
Cut Sheet Duplex
2
2
5
Continuous
2
2
6
Ink Jet Addressing
1
0
9
Self Mailers
2
6
10
2-24 pp
3
9
11
26-60 pp
3
9
12
60 pp+
3
9
The sample data above shows 2 root nodes (ID 2 and 6), with every other node being a child of something else. The parent field corresponds to the ID of that node's parent. In Access, it's really easy to polulate this data in a treeview. I created a ADO connection and loaded the table into a recordset called "rsService" and then looped through each record like this:
Do Until rsService.EOF If rsService.Fields("Hierarchy") = 1 Then tvwServices.Nodes.Add Key:="S" & rsService.Fields("ID"), _ Text:=rsService.Fields("Name") Else tvwServices.Nodes.Add Key:="S" & rsService.Fields("ID"), _ Text:=rsService.Fields("Name"), _ Relative:="S" & rsService.Fields("Parent"), _ Relationship:=tvwChild End If rsService.MoveNext Loop
The key here is the "Relative" argument. In Access I can specify what node will be the parent. From all the help files and forums I've read so far, it seems that VB.NET looks at things the other way around. Where when you add a node, you specify the children rather than the parent. Is there an easy way to populate a treeview control in VB.NET 2005 without completely re-organizing my data Tag: Windows Forms General ToolStrip problem Windows Forms
About MouseMove message UseCase1:
- Press mouse left button on windows form control
- Don't move mouse and release the left button
The mouse message will be "WM_MouseDown", "WM_MouseUP", "WM_MouseCaptureChanged" and "WM_MouseMove"
Why does control receive the last receive message
UseCase2:
- Write a custom control inherit from system control
- Override WndProc function, adn write the following code: public class MyControl2 : Control { protected override void WndProc(ref Message m) {
//WM_LButtonUp message if (m.Msg == 0x202) { return; }
base.WndProc(ref m); }
}
- Repeat the action in usecase1
the mouse message will be "WM_MouseDown", "WM_MouseUP",
Why does the last MouseMove message disappaer Tag: Windows Forms General ToolStrip problem Windows Forms
Data Grid results dissapear when Master Table is Filtered Newbie. I have a Master table [Current_Jobs] displayed in windows form Details format. On the same form I have the table [DeliveryDates] displayed as a data Grid View.
Everything works nicely
I have a "search" button that filters data results of [current_jobs]
When I run the search the Master table is filtered fine but all the child datagridview results dissappear.
I assume it's because I need to bind the datagridview control to a differnt source.. need help please!! Tag: Windows Forms General ToolStrip problem Windows Forms
Rowediting does not work? Hi there,
I am not sure if I am right within this forum but it's worth a try:
I try to build a GridView and receive the data from SQL Server 2005 - if I implement the source within the .aspx-file it works fine to make the rows able to be edited (
< asp : SqlDataSource ID ="SqlDataSource1" runat ="server" ConnectionString =" <%$ ConnectionStrings:ACUConnectionString %> " SelectCommand ="SELECT * FROM [Access_level]"> </ asp : SqlDataSource >
But if I try to implement the datasource within the pageload nothing happens on a edit-click.
Therefore I implemented an event onRowEditing but now I do not know how I make the fields editable
Hopefully you know a solution (and much more hopefully this forum is a good one to answer things like that....
Regards, Jochen Tag: Windows Forms General ToolStrip problem Windows Forms
Using a link in a datagrid view. Hello All!
I have a datagrid in my windows form, working in vb.net. I made the "First Name" a label link. What I would like to do is the same thing I can do in a web application. Click on the link, and the details of that record fill another small datagrid in the second form. Can sombody show me a sample or point me in a direction on how I can do this in a windows form.
Thanks!
Rudy Tag: Windows Forms General ToolStrip problem Windows Forms
How can I get Select EventHandler for ToolStripMenuItem How can I get Select EventHandler for ToolStripMenuItem as I we can get Select EventHandler for MenuItem
In Case of MenuItem:
MenuItem mi = new MenuItem("File");
mi.Select +=new EventHandler(mi_Select);
In Case of ToolStripMenuItem:
ToolStripMenuItem tsmi = new ToolStripMenuItem("File");
Tsmi. What should I do Tag: Windows Forms General ToolStrip problem Windows Forms
Checkedlistbox event to update a label Basically i am trying to find something like "checked state changed" event, but cant seem to find it. Here what im trying to do, its pretty simple. I have a checkedlistbox that creates a byte. []bit1 []bit2 []bit3 []bit4 . . . I want to create a label that displays the value of the byte based on the selected items on that list. I tried using the "SelectedIndexChanged" event, that calls a method called updateCommandByte.
Code: private byte updateCommandByte() { byte bVal = 0; for (int i = 0; i < commandByteCListBox.Items.Count; i++) { if (commandByteCListBox.GetItemChecked(i)) { bVal = (byte)(bVal + Math.Pow(2, i)); //dFormatLabel1.Text = "Decimal Format: " + bVal.ToString(); CheckSumLabel.Text = "Binary Format: " + Convert.ToString(bVal); } //hFormatLabel1.Text = "Hex Format: " + bVal.ToString("X2"); } return bVal; } his somewhat works, but ONLY if the SelectedIndexChanged event is raised. In other words, if my mouse dont move and i keep toggling the same checkbox on/off, the event doenst get raised. I need a way to call that method everytime the checkstatus of ANY box is changed. I also tried the Item_Check event but the problem with it, is that it seems the raise the event BEFORE the actual box is checked. SO when i check it the first time, nothing happens ( in debug mode, the IF condition evaluates to false ). But i uncheck it and check it again, now it evaluates to true. Im really confused Help Tag: Windows Forms General ToolStrip problem Windows Forms
OnCellPainting problem in DataGridView Hi,
Ive written a customised version of the Microsoft .net 2 DataGridView. I did this by inheriting the MS one and setting some features in the inherited one to make the style consistant throughtout my app (alternating line colors, single row selection by default, yada yada). I was asked to add icons to the row header (on the left of the grid) to symbolise the state of some of the data in the grid. I did this by overriding the OnCellPainting method. heres roughly how it looks (ive removed some of the different STATUSes as they all do effectively the same)
override void OnCellPainting( DataGridViewCellPaintingEventArgs e)
{
e.Handled = false ;
if ((e.ColumnIndex == -1) && (e.RowIndex > -1))
{
e.Graphics.FillRectangle( new SolidBrush ( SystemColors .Control), e.CellBounds);
e.Graphics.DrawRectangle( new Pen ( new SolidBrush (GridColor)), e.CellBounds);
System.Drawing.Imaging. ImageAttributes imageAttribute = new System.Drawing.Imaging. ImageAttributes ();
imageAttribute.SetColorKey( Color .Magenta, Color .Magenta, System.Drawing.Imaging. ColorAdjustType .Bitmap);
Bitmap b = null ;
if ( this [ "STATUS" , e.RowIndex].Value.ToString() == "WIP" )
b = Properties. Resource .WIP.ToBitmap();
if ( this [ "STATUS" , e.RowIndex].Value.ToString() == "QA REQUIRED" )
b = Properties. Resource .QAREQUIRED.ToBitmap();
if ( this [ "STATUS" , e.RowIndex].Value.ToString() == "PENDING" )
b = Properties. Resource .PENDING.ToBitmap();
if (b != null )
{
e.Graphics.DrawImage(b, new System.Drawing. Rectangle (e.CellBounds.Left + 3, e.CellBounds.Top + 3, b.Size.Width, b.Size.Height), 0, 0, b.Width,
b.Height, GraphicsUnit .Pixel, imageAttribute);
e.Handled = true ;
}
}
base.OnCellPainting(e);
}
Now this works absolultely fine, most of the time. However there is a single case where it doesnt work, and unfortunately it is on a remote PC and I cannot replicate the problem. The grid is embedded in 2 forms in my DLL. 1 form is called in 1 application, the other in another application. 2 forms are almost identical, and the grid was created by simply dropping it onto the form in both. In PCs with Intel 915GM graphics processors, it works fine in 1 app, but not in the other. On all other PCs Ive tested on (all of which have different graphics chips) the code runs fine in both apps. I dont think I'm doing anything too weird that should make it fail, but with the 1 graphics chipset the entire grid simply renders solid black, except for the 1st top left cell (Well, the 1st top left cell under the column headers). If Ive not been clear I can probably post some pictures somewhere if needbe. The end user has tried updating the system to use the latest WHQL drivers to no avail. As I say, it renders fine in 1 app, but not in another, despite being created the exact same way and using the exact same control. Is there any other way of accomplishing what I need to do in another way All i need to do is render a small 16x16 icon to the leftmost cell for a given row. Can anyone see anything obviously wrong with the above code that might make it fail and therefore fail to render every cell after the 1st one is there any gotchas I should be aware of with using the OnCellPainting
Any thougths on this strange situation would be extremely good.
Regards Neil Tag: Windows Forms General ToolStrip problem Windows Forms
cygnusx
Ok,i have a ToolStrip control and have a buttons on it,when i click on the one of the buttons at the runtime the cursor starts blinking.How to fix that
You may do some wrong in your code, just drag a ToolStrip onto the form and add some buttons to it is OK without blinking when clicking. Post some code please.