|
Just add a checkbox in a column definition. There are heaps of samples here and elsewhere on the web.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi,
in my project i want to display report on a btn click.
i did it as
cryRpt1.connect=(connection string)
i am getting an error incorrect log on parameters.
please tell me the correct syntex for this connection. my server is sql server and database is sql server datebase and both r on same machine.
|
|
|
|
|
hi,
there are two tables
table name PROJECT_CATEGORY
fields PROJECT_CAT VARCHAR(3) PRIMARY KEY
CAT_ACTIVE VARCHAR(1)
table name PROJECT_DETAILS
PROJECT_CODE VARCHAR(6) PRIMARY KEY
PROJECT_CAT VARCHAR(3) REFERENCE PROJECT_CATEGORY(PROJECT_CAT)
In a form to fill project details i have used DATAGRID. to fill project category i want categories from table PROJECT_CATEGORY to be listed in datagrid cell with button (dropdown).
PLEASE HELP. thanks.
-- modified at 0:13 Saturday 10th February, 2007
|
|
|
|
|
Hello guys
I am reading values from a table from a DB
what i want is to color the BackColor of the row for specific values
exemple :
if row1 at column("columname") ="xxx" --- color row1 in blue
if row1 at column("columnname") ="yyy" --- color row1 in yellow
and dont change the color of the other row
Regards
Ramy
|
|
|
|
|
Hello,
Try the DataGridView_CellFormatting method.
You can specify some rowdetails like ForeColor, BackColor, etc. depending on the value of the cell.
Good luck!
Jan
|
|
|
|
|
Hello!
I am using VB.Net 2005 and I would like to know if there is way to define an array for a single label or picturebox object at design time.
Thanks!
Bedri
|
|
|
|
|
What do you want ? What sort of array do you mean ? An array of pixels ? Of letters ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
My aim is to store the letters in two dimensional array. The array must be a label object so I can easily place pictures behind of these labels also. I have 10 rows and 8 columns in each row. It is a simple matrix but must be made by label objects.
If I do this internally (nor at design time), How I could write AdHandlers for each specific label object to check if it is selected or clicked.
Thanks a lot!
|
|
|
|
|
Sounds like you need to write a custom control. Do you mean each label contains a letter, but the letters also map back to positions in an array, so if you change the array, the controls change ? If so, you need to write code to map an array of letters to an array of controls.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i know this is a c# forum but couldn't find one vb. if i get a sample how to it in C# no prob i can convert it
Default using vb.net to post to a website
i want to post a string to a website can anyone show me or point me to example of how you would use vb.net to post a string to a website and accept the response sent back from post / request to the site?
|
|
|
|
|
Hello,
1°) I would like to know how to recognize a readonly directory in advance
only without having to await the code error of return in attempt at writing
on this one as one can let it to know if a file is system, file, reading, hidden.
2°) I would like to also know how to detect the authorizations (permissions,
accounts authorized) of writing on a directory without having to await the code error of return in attempt at writing on this one like one does it for
a file.
This question is independent of the first because the directory can be
in read/write but that only for certain people thus useless to go further if it is already in readonly mode.
I tested by the code according to various tests:
Dim FolderBrowserDialog1 as FolderBrowserDialog = New FolderBrowserDialog()
Dim MyAttr asFileAttribute
If FolderBrowserDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
MyAttr = GetAttr(FolderBrowserDialog1.SelectedPath)
MsgBox(MyAttr.ToString) 'response : Directory
MsgBox(File.GetAttributes(FolderBrowserDialog1.SelectedPath).ToString)
'response : Directory
Dim information as System.IO.FileInfo
information =
My.Computer.FileSystem.GetFileInfo(FolderBrowserDialog1.SelectedPath)
MsgBox(information.IsReadOnly) 'response : always false even if the
directory is readonly mode
End If
in advance thank you with all
|
|
|
|
|
A ReadOnly folder is easy enough. All you need in the File class and it's GetAttributes[^] method.
You shouldn't be attempting to calculate your own access levels. There's simply so many levels of security and inheritance affecting file access from your code that the best way of reliably testing access is to try to create your file! You can calculate NTFS permissions all you want, but code access permissions can also affect your ability to write a file. What this means is that NTFS can say that it's perfectly OK for you to create a file, but code access permissions can deny you!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi.
can someone pls direct me in how i can go about working out how i can capture printpreview/printdocument data and save into a file for example
doc, txt ,pdf or anything you can assist with..
many thanks.
Robbo
|
|
|
|
|
Are you trying to capture the data that's going to the printer?? Or are you trying to capture an image of the Print Preview?? In your application or any application??
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi Dave. Thanks for replying. ive already got a print method working where i can see data in print preview but need to work out if i can capture everything in my print preview and save it to a file whether it'd be a pdf or doc or anything you can advise me with. and YES its for my APP and in my app that i need to do this.
Thanks Dave
Robbo
|
|
|
|
|
You'd use the same code you use to draw your print document to draw to a bitmap if you wanted.
A PDF is a bit of a different story. You'd have to use some kind of PDF library to create the file and you can probably get away with using, again, the same drawing code you're using to generate the print preview.
I don't have any example or knoweldge of any PDF libraries because I simply don't need them and don't use them for anything I do. There's a bunch of them though, just Google for ".net pdf library"[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
thanks dave. so what function or commands am i looking to use and to capture the bitmap.
|
|
|
|
|
There really isn't any. You create a bitmap object the size you need, then create a Graphics object from it, pass that to your drawing code and your code should draw everything using that Graphics object. Done. Everything just got drawn to your bitmap. You can do whatever you want with the image then.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I am having difficulty iterating through an array. I have found the following sample code and tried modifying it with my variables.
' Sample Array Read Code
'For i = 0 To arrList2.Count - 1
' Console.WriteLine(CStr(arrList2.Item(i)))
'Next
After modifying line 3 with x = CStr(arrList2.Item(i)) , I receive the following error: "Value of type 'String' cannot be converted to '1-dimensional array of String'." X is defined as: Dim x() As String
I need to get each element (which is a name read from a textbox) into a variable strName. This is to allow my SQL statement to create a record for each name in the array.
Any help would be greatly appreciated!
Thank you in advance.
LWhite
|
|
|
|
|
Larry White wrote: After modifying line 3 with x = CStr(arrList2.Item(i)) , I receive the following error: "Value of type 'String' cannot be converted to '1-dimensional array of String'." X is defined as: Dim x() As String
It's always best to copy and paste the actual code you're using. Don't post a sample and then tell use what you did to it. It makes it very difficult to see what you actually did.
x doesn't have an Item property, so the code should look more like this:
For i = 0 To x.GetUpperBound(0)
Console.WriteLine(x(i))
Next i
Notice, you don't need CSTR. This is because your x array is an array of Strings. Why try to convert a String to a String??
Also, to get your code to show up in the nice beige box and retain some formatting, paste it between <pre> and </pre> tags.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thank you. The tags do make it alot easier to read.
LWhite
|
|
|
|
|
Why do you declare the x variable as an array? As you are going to use it to reference a string, declare it as a string:
Dim x As String
---
single minded; short sighted; long gone;
|
|
|
|
|
I adjusted my code as follows:
Dim x As String
For i = 0 To arrList2.Count - 1
x = arrList2.Item(i)
strName = arrList2.Item(i)
I now get the qty of data entries in my database equal to the number of names I select in the textbox, but the last entry is blank. If I select 3 names, I get the first 2 database entries with the names, but the last one is blank (name field). It appears the first iteration leaves strName blank.
Thanks again for the assistance.
LWhite
|
|
|
|
|
The code that you have shown is correct, although reading the same value from the array twice into separate variables doesn't look like what you want to do.
The problem that you talk about is in the part of the code that you haven't shown. Unless you show it, I can't tell you much more than that it's wrong...
---
single minded; short sighted; long gone;
|
|
|
|
|
Here are the other relevant parts of my code. I build the textbox entries with the following, which also drops the selected names into the array:
Private Sub lbName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lbName.SelectedIndexChanged
editName.Text = Nothing
For i = 0 To lbName.SelectedItems.Count - 1
arrList2.Add(strName)
With arrList2
.ToArray()
End With
editName.Text = editName.Text & lbName.SelectedItems(i) & vbCrLf
strName = lbName.SelectedItems(i) & vbCrLf
Next
End Sub
Here is my complete code that is supposed to create a new database record with each iteration of the name array:
For i = 0 To arrList2.Count - 1
strName = arrList2.Item(i)
x = arrList2.Item(i)
Dim strCommandText As String = "INSERT INTO Orders(OrderDate, DeliverDate, DeliverLocation, Name, Special, Comments, Rate, EMPLID, LoggedIP)" _
& "VALUES('" & strOrderDate & "','" & strDeliverDate & "','" & strDeliverLocation & "','" & strName & "','" & strSpecial & "','" & strComments & "','" & strRate & "','" & strEMPLID & "','" & strLoggedHost & "')"
Dim cmd As New SqlClient.SqlCommand(strCommandText, SqlConnection1)
cmd.ExecuteNonQuery()
Next
Thank you for your assistance.
LWhite
|
|
|
|