|
I have a datagridview that gets its data from a bound datatable.
I want to make the column into a checkbox column
Something like this, I think, but this isn't quite it.
DataGridToUse.Columns("Active").DefaultCellStyle = Windows.Forms.DataGridViewCheckBoxColumn
thanks in advance
|
|
|
|
|
you can use the designer to change the type of column. in the designer click on the column and view its properties. you should see a property that will change from text to link to checkbox etc.
|
|
|
|
|
Oh sorry, I forgot to mention that this datagrid is being created during runtime.
|
|
|
|
|
You're probably looking for something along the lines of:
With DataGridView1
.Columns.Clear()
Dim newCol As New DataGridViewCheckBoxColumn
newCol.HeaderText = "Header"
newCol.DataPropertyName = "dbColumnName"
newCol.DataSource = dataSource
newCol.ValueMember = "dbColumnName"
newCol.DisplayMember = "dbColumnName"
newCol.Width = 160
.Columns.Add(newCol)
End With
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Try this:
' Initialize and add a check box column.
column = New DataGridViewCheckBoxColumn()
column.DataPropertyName = "GoodGuy"
column.Name = "Good"
dataGridView1.Columns.Add(column)
|
|
|
|
|
|
Hey all
I have a problem updating AD when the value I want to pass in is empty. When I do this I get a login credentials pop up but when the value is not empty it updates fine. An example piece of code:
<br />
Dim user as DirectoryEntry<br />
Dim name as string = ""<br />
<br />
user = getUserFromAD(AccountID) 'This returns a directory entry from AD<br />
<br />
user.Properties("givenName").Value = name<br />
If I actually go to AD and modify it then empty strings are allowed.
Any help will be much appreciated, thanks in advance.
|
|
|
|
|
I'm not 100% sure about this, but I don't think you can't set a property to an empty, or null, value. In order to accompish something similar to that, you'd have to remove the property involved from the properties collection of the host object.
Sorry, I don't have any examples because I haven't done any AD development.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Cheers, I thought it would be something like that. I'll just use the work-around of entering a single space in when the value I want to send in is empty, then when retrieving the data I'll check for that and return an empty string to the UI.
|
|
|
|
|
i want to learn how to send email only using api
thanx in advance for any help
|
|
|
|
|
DotNet54 wrote: i want to learn how to send email only using api
What API? The only way to send Mail in VB.NET is through an API. The one provided by .NET would be the easiest I'd imagine.
|
|
|
|
|
sorry i was asking about vb 6.0
|
|
|
|
|
You can use a mail component.
Or use SMTP commands directly with all error handling using the WinSock control.
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
if you're using visual studio then you can take a look at the code snippets section and it will add code so you can send an email through smtp
|
|
|
|
|
Hello Frends, I am creating a client server aplication with Vb.net and sql server 2000, which reads and writes cliente information to database. I want to store the database connection string in aplication configuration file(App.config), so that when the aplication is compiled and installed at the client site, users can go to the aplication directory files and change the connection information based on the actual server name, etc.
so for application configuration file I did:
<appSettings>
< add key= "strConetionSQl" value=="Data Source=A2-02;AttachDbFilename=|DataDirectory|\Databases\interdit.mdf;Integrated Security=True;User Instance=True"/>
</appSettings>
and on the users form login button I used:
Dim strConetionSQl As String = ConfigurationSettings.AppSettings("strConexaoBD")
conn.ConnectionString = strConetionSQl
conn.Open()
so, when I debug the aplication I get this error from the strConetionSQl:
An unhandled exception of type 'System.Configuration.ConfigurationException' occurred in system.dll
Additional information: This is an unexpected token. The expected token is 'NAME'. Line 4, position 5.
|
|
|
|
|
You have a double equals (==) after the value in the config file. It should be a single equals.
|
|
|
|
|
I have finished writing an FTP application for my company. I am looking for the best way to deploy the application and provide updates. I have been looking at using ClickOnce deployment provided by Visual Studio. The problem that I am running into is that I don't like the fact that if you use ClickOnce you can not configure it to place an icon on the desktop and it does not create a program folder. I don't want to use MSI packages because it will be too complicated to get to all the needed users. The way I want it to work is that I can deploy the application to a web server and through some programmatic logic, have it check that server periodically for updates. If someone could point me in the right direction I would greatly appreciate it.
Thanks
|
|
|
|
|
Hi,
I have a form with a datagrid. The datagrid has a dataset as a source, and a TableStyle to make it all look good. The dataset gets manipulated in different ways, and the datagrid is refreshed between manipulations, to show changes to the user.
However, after the first manipulation / refresh the vertical scrollbar disappears, and I almost haven't got a clue why.
I use this public function in a module to do the refreshing, as there are several different forms in my app with their own datagrids:
<br />
Public Function refreshGrid(ByVal Grid As DataGrid, ByVal DS As DataSet, ByVal Member As String, ByVal frm As Form)<br />
Try<br />
DS.AcceptChanges()<br />
Grid.DataSource = DS<br />
Grid.DataMember = Member<br />
frm.Refresh()<br />
Catch Ex As Exception<br />
MsgBox(Ex.Message)<br />
End Try<br />
End Function<br />
As it doesn't throw errors, and it seems to actually refresh the datagrid, can anyone tell me whether I am making some mistake in my code, or whether the whole idea of a function for this operation is wrong, or any other possible reason for my Amazing Disappearing Scrollbar?
I Appreciate the help,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
I wrote an AP that copy a user PST files to a network drive, it works fine, but the problem is, if I want to install it to every user's machine I have to change user profile path were the original data is located.
What I would like to do is for it to recognise the loged user, and once the user is ready just click on Start Button and start copying.
If anyone can Help I will be very greatfull.
This is a part of the code:
<'Copy all the PST files from Outlook directory
fileop.ClearSourceFiles
fileop.AddSourceFile "C:\Documents and Settings\USERNAME\Local Settings\Application Data\Microsoft\Outlook\*.pst"
'To a Network Drive
fileop.ClearDestFiles
fileop.AddDestFile "Z:\office xp"
'Copy the files
If Not fileop.CopyFiles Then
MsgBox "Not successfully completed."
Exit Sub
End If
MsgBox "Files copied Successfully", vbOKOnly
End >
-- modified at 8:11 Friday 9th February, 2007
|
|
|
|
|
Hi all,
Quick question, I am trying to save a data table to a excel work sheet, but I want to format it, so that it saves with nice borders and the text is aligned etc.
Could any one point me in the direction of this information. I know how to change the text etc, but not how to add borders, align text or anything else. I have included some code below for what I know how to do but I am lost on how to bring it further. - I have tried some obvious lines of code to try and get to text align functions but nothing works???
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
'Start a new workbook in Excel.
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Add
'Add data to cells of the first worksheet in the new workbook.
oSheet = oBook.Worksheets(1)
With oExcel
.Range("A2").Resize(workTable.Columns.Count, workTable.Rows.Count + 1).Value = DataArray
.Columns("A:W").ColumnWidth = 18
.Rows("1:20").RowHeight = 15
.Rows("5").RowHeight = 30
.Columns.Wraptext = True
.Rows.Wraptext = True
With .Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.ColorIndex = 5
End With
End With
|
|
|
|
|
Hi all,
Quick question, I am trying to save a data table to a excel work sheet, but I want to format it, so that it saves with nice borders and the text is aligned etc.
Could any one point me in the direction of this information. I know how to change the text etc, but not how to add borders, align text or anything else. I have included some code below for what I know how to do but I am lost on how to bring it further. - I have tried some obvious lines of code to try and get to text align functions but nothing works???
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
'Start a new workbook in Excel.
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Add
'Add data to cells of the first worksheet in the new workbook.
oSheet = oBook.Worksheets(1)
With oExcel
.Range("A2").Resize(workTable.Columns.Count, workTable.Rows.Count + 1).Value = DataArray
.Columns("A:W").ColumnWidth = 18
.Rows("1:20").RowHeight = 15
.Rows("5").RowHeight = 30
.Columns.Wraptext = True
.Rows.Wraptext = True
With .Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.ColorIndex = 5
End With
End With
|
|
|
|
|
hi all,
I want to create a timer programatically in VB.Net and need to activate
its Tick event. I have created the timer by using the following
statements:
Dim tmr As New System.Windows.Forms.Timer
tmr.Interval = 10000
How can I fire its Tick event? actually i want to perform a particular action in every 10 minuts.
any help will be appreciated...
thanks in advance
sebastian
|
|
|
|
|
Hi Sebastian,
Use withevents tmr As New System.Windows.Forms.Timer instead of dim, and the Class Name dropdown in the code window will offer you your tmr.
Start the timer (tmr.Start() ) use its Tick event to perform whatever code you need, and if necessary stop the timer (tmr.Stop() ).
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
hi
it worked
thank you so much
sebastian
|
|
|
|
|
Your welcome.
Enjoy,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|