|
|
The best way is to use properties to pass stuff back and forth, but you don't have to restrict yourself to properties you define. For instance, if you want to collect a chunk of text in the second form, you can code something like this, assuming you have a text box on the second form:
<br />
Dim MyString as string<br />
Dim dlg as new FormTwo<br />
Dim result as DialogResult<br />
<br />
dlg.TextBox1.text = "Default Value"<br />
result = dlg.ShowDialog()<br />
If result = DialogResult.OK Then<br />
MyString = dlg.TextBox1.text<br />
Else<br />
' Some kind of error handling code<br />
End If<br />
JimT
|
|
|
|
|
Hallo Friends,
Need Help
I hav deployed my vb.net(Winforms)2005 application on client m/c through setup of my application.
In application's setup i hav added merge module CrystalReports10_maps.msm.
but when i m opening my crystal report through my application on client side machine it is asking for login id & password. My database is in mysql. I m giving the userid & password tht using in my application , but it says-> Logon failed.
Application is showing other forms but asking login only for crystal report.
Please help me.
-Thanks for any help in advance.
|
|
|
|
|
Hey,
If you don't want to be prompted for database credentials when you open the crystal report you should change the database connection (in crystal, under Database > Database Expert) to use integrated security as opposed to typing in the username / password.
Later
Nathan Lindley
|
|
|
|
|
Hi,
Im using .Net 2, creating a user entry form.
How do I prevent 1 or more characters from being entered into a textbox.
For example: one textbox, I dont want a user entering slashes or single quotes.
In another textbox, I dont want the user entering single quotes.
Have I got to write a whole validation thing, or is there some sort of formatting or regex I can use?
Any response gratefully appreciated.
Mark
|
|
|
|
|
Hi Mark
You can use regular expressions as far as i know to do what you want or you could use a masked textbox in .Net 2.0.
However to do what you want you need to you use the keypress event of a textbox and ignore character you dont want to allow by setting e.handled = true.
Private Sub txtText1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtText1.KeyPress
'If the key pressed is ' or " or any type of punctuation mark then do not allow
If e.KeyChar.IsPunctuation(e.KeyChar) Then
e.Handled = True
End If
End Sub
'This will ignore a backslash
If e.KeyChar = Microsoft.VisualBasic.Chr(Keys.OemBackslash) Then
e.Handled = True
End If
Hope this Helps
Keith
|
|
|
|
|
Hi everybody
I work with many projects (Visual basic 2005) that i use in many different solutions, but i have a problem with compiling the projects. I need to set the result dir of all my proyects with base on solution's dir. Ex:
Solution dir: C:\MySolution
Proyects:
project1 code dir: C:\Proyects\Proyect1
Proyect1 result dir: c:\Mysolution\bin
project2 code dir: C:\Proyects\Proyect2
Proyect2 result dir: c:\Mysolution\bin
.....
I won't to change manually all result dir when i change the solution so i hope anyone can help me (i've tried on generation event but doesn't work)
Thank you
.J2
|
|
|
|
|
I suggest not changing the target folders for the build binaries. Instead, go into the Project Properties, Build Events button, and create a Post-Build event that launches a batch file to copy the resulting files to where you need them.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thank you very much for your help. This is the solution i need.
.J2
|
|
|
|
|
:(Actually I created a form, which is a MDI.
I then took a form(form 2),which is a child form.
Now when i run the application the child form (form 2)
comes within the MDI.
But now the problem is how i can fix the child form
inside the MDI.
I tried the following code
form2.minimize=false
form2.maximize=false
when i double click the status bar the form size changes
so it moves within the MDI.Now how can i fix it ?.
|
|
|
|
|
Hello,
u need to change it's border style..
i think there is a fixed border style, selete it, u will get ur answer
Thanks,
Ankur Bakliwal
|
|
|
|
|
Hi,
I want to store the Documents in ACCESS But access is accepting only 255 characters.
is it Possible?????.....Pls tel me.... way....
thanking you
somasundaram G
|
|
|
|
|
Access has a type of field called Memo this will probably work for short documents but i doubt it will be able to save large documents.
Regards
Keith
|
|
|
|
|
Goodmorning friends,
I hav problem when i opened crystal report through my application on my client's machine.
i m using vb.net 2005 & mysql.
.net framework & connector required are already installed on my client machine, So application is runng all right.
but problem is only while opening crystal reports.
So i searched on net for help....Merge module shuld be included in project setup.
1)I have downloaded merge module "CrystalReportsRedist2005_x86.msm" & kept in my
"C:\Program Files\Common Files\Merge Modules" & have included it while building setup project.
2)it is necessary to include managed.msm file
& i m not getting this file
Anyone please help me.
priya
|
|
|
|
|
I have a datagridview to show data. My datagridview is using datasource to binding data. Now my question is , How can i add a new column as checkbox in front of each row? ( means if i have 3 row of record, each row will have one check box ) and store a value to it ? and how i check this checkbox is checked or unchecked ?
thanks.
Best regards,
Chee ken
|
|
|
|
|
You should add the checkbox to the datagrid as a template column. Then you will basically step through the datagrid looking to see if the control exists based on the ID you gave it in the template column and then DirectCast(item, Checkbox) and see if it is .Checked = True or not.
I hope that helps.
Cleako
|
|
|
|
|
hi,
i wnt to write code that shuld be executed when user clicks on checkbox that is present as datagrid columne.
where should i write the code.
priya
|
|
|
|
|
Since you are changing the topic you should start your own thread.
BUT, you just need to set a function name to be called in the OnClick event of the template column's checkbox. That function should be Protected instead of Private.
Cleako
|
|
|
|
|
Can anyone help?
I have a collection class called Customers that allows users to add Customer objects etc. The customer objects are held in a collection. The Customers class implements IEnumerable to enable users to enumerate through the collection via for each and has a public property called Datasource so a user can bind this collection to a datagrid for example. However, after binding the datasource I cannot hide the relevant columns that represent public properties of the class Customer which I assume is because the Collection Class does not implement IList. Apart from making these properties in Customer private or implementing IList, is there any other way I can hide these columns but still bind the datagrid to the collection?
Cheers JazzyJ
|
|
|
|
|
Hi,
Use TableStyles and GridColumnStyles from the DataGrid properties. They work like a mask, you map the TableStyle to the entire collection and each GridColumnStyle to a column in your collection. Then you have two ways to hide the columns from a user: 1. Just don't create a GridColumnStyle for the columns you want to hide. or 2. Create GridColumnStyles for all you columns, and set the width of the columns you want to hide to 0 or 1 or something.
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi Johan,
Thanks for your reply. I'm pretty new to VB.net so I apologise if I'm slow to catch on.
I am currently using the DataGridTableStyle and DataGridTextBoxColumm classes to modify the appearance of the datagrid but this doesn't seem to work. Is this the same as mapping to the TableStyle and GridStyleColumm classes you refer to?
My code is as follows:
Dim ts As DataGridTableStyle = New DataGridTableStyle
ts.MappingName = Clients.ActiveRecord.Branchs.MappingName
ts.AlternatingBackColor = System.Drawing.Color.LightBlue
Dim BranchIDColumn As New DataGridTextBoxColumn
BranchIDColumn.MappingName = "BranchID"
BranchIDColumn.HeaderText = "Branch ID"
BranchIDColumn.Width = 0
Dim BranchNameColumn As New DataGridTextBoxColumn
BranchNameColumn.MappingName = "Name"
BranchNameColumn.HeaderText = "Name"
BranchNameColumn.Width = 1000
Dim ClientIDColumn As New DataGridTextBoxColumn
ClientIDColumn.MappingName = "ClientID"
ClientIDColumn.HeaderText = "Client ID"
ClientIDColumn.Width = 0
Dim BranchDateColumn As New DataGridTextBoxColumn
BranchDateColumn.MappingName = "ModifiedDate"
BranchDateColumn.HeaderText = "Modified Date"
BranchDateColumn.Width = 0
' Adds the column styles to the grid table style.
ts.GridColumnStyles.Add(BranchIDColumn)
ts.GridColumnStyles.Add(BranchNameColumn)
ts.GridColumnStyles.Add(ClientIDColumn)
ts.GridColumnStyles.Add(BranchDateColumn)
' Add the table style to the collection, but clear the
' collection first.
Me.datBranchs.TableStyles.Clear()
Me.datBranchs.TableStyles.Add(ts)
' set datasource and hide columns
Me.datBranchs.SetDataBinding(Clients.ActiveRecord.Branchs.DataSource, "")
I have moved the SetDataBinding method to before I create the DataGridTableStyle and to the end where it currently is to see if that is the problem but all columns are visible even though I have set some to 0.
The mapping name is a string that is the class name of the objects stored in the collection ie. "clsBranch[]"
Thanks for any help you can provide.
David
|
|
|
|
|
Hi David,
As far as I can tell, you have build the TableStyle and everything correctly. However, because you create the TableStyle at runtime, you also need to link the TableStyle to the datagrid. By the look of things, that's all that is missing from your code.
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Thanks Johan. I will give that a go.
Kind regards
David
|
|
|
|
|
Hi Johan,
At the bottom of the code I add the table style to the tablestyles collection of the datagrid.
Me.datBranchs.TableStyles.Add(ts)
Is that what you mean by linking the tablestyle to the datagrid because it still doesn't work??? Maybe I should find another job!
Kind regards
David;)
|
|
|
|
|
Hi David,
No need to get another job, just do like me: lure a poor coder from India, Pakistan or Sri Lanka to where you live, with the empty promise of a greencard, have him do all the work, and claim it as your own.
But seriously...
You really did write it by the book, as far as I can tell, so I am not entirely sure why it still doesn't work. The only thing I can think of, for you to try is to use:
<br />
datBranchs.DataSource = WhatWasYourSourceDataSetAgain<br />
datBranchs.DataMember = "WhatTableInYouDataSetWasIt_IDontRemember"<br />
instead of .DataBinding at the end.
Regards,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|