|
I tried the code below,but the result isnt as expected.
Dim hti As DataGridView.HitTestInfo = DataGridView1.HitTest(e.X, e.Y)
column1 = hti.ColumnIndex
If e.Button = Windows.Forms.MouseButtons.Right Then
If hti.ColumnIndex = 1 Then
DataGridView1.ContextMenuStrip = ContextMenuStrip1
DataGridView1.ContextMenuStrip.Enabled = False
DataGridView1.ContextMenuStrip.Visible = False
Else
DataGridView1.ContextMenuStrip = ContextMenuStrip1
End If
End If
When I click on the second column the menu strip still appears but it appears disable.So the enabled=false is fine but why isn't the visible= false working?
|
|
|
|
|
Instead of taking this much pain, just reinitialize the contextmenustrip for the second column. Change the following C# code to VB.
this.dataGridView1.ContextMenuStrip = oContextMnuStrip;
this.dataGridView1.Columns[1].ContextMenuStrip = new ContextMenuStrip();
You will not need any extra code then.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
Ok..thanks alot.Regarding disabling the column selection where is SetSelectedColumnCore method found in vb.net?
|
|
|
|
|
It is there in the DataGridView class. Since it is protected virtual method, you will need to inherit the DataGridView class in order to override.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
Ok..that sounds a little complicated for me,is there any other simpler way or do you have any code samples for it.
Also after i select a cell and click on the context menu,the cell at 0,0 gets selected by default.I dont want any cell to get highlighted unless i click on it.How can this be done?
|
|
|
|
|
Sohaib_A wrote: Ok..that sounds a little complicated for me,is there any other simpler way or do you have any code samples for it.
Cant think of any other way.
Sohaib_A wrote: Also after i select a cell and click on the context menu,the cell at 0,0 gets selected by default.I dont want any cell to get highlighted unless i click on it.How can this be done?
Setting focus might work out.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
Hello
I am using VS .NET 2005 with the built-in Crystal Reports to write a Windows Forms / VB.NET based application.
I have designed the report .RPTs using the DataSet available in the design environment. Additionally, I have also inserted some Text Objects and Unbound Fields onto the report.
1. Is there a way I can pass on values to these objects / fields at run-time, through code (no Parameter fields)?
2. Also, how do I populate the Special fields like "Report Title" etc?
Please help! Its a desperate situation for me
It would be great if you can illustrate with some code samples.
Thanks
|
|
|
|
|
I don't use CrystalReports, but what I could gleen from the web resulted in this:
Dim myReport As New SomeReport
myReport.DataDefinition.FormulaFields["UnboundFieldName"].Text = DateTime.Now.ToString()
|
|
|
|
|
Try this on for size....
Dim objReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim tReportName As String = "Prescription Evaluation"
Dim bCreateSchema As Boolean
'bCreateSchema = True ' ***** TESTING ONLY
Dim tTemp As String = txtClientName.Text
tTemp = Replace(tTemp, "'", "~")
objReport = New cryCLPrescriptioinForEvaluationChild
tReportName = "Prescription Evaluation Child"
' set any passed variables
Dim iII As Integer = 0
For iII = 0 To objReport.DataDefinition.FormulaFields.Count - 1 Step 1
Select Case objReport.DataDefinition.FormulaFields(iII).Name
Case "ClientName"
objReport.DataDefinition.FormulaFields(iII).Text = "'" & tTemp & "'"
Case "DOB"
objReport.DataDefinition.FormulaFields(iII).Text = "'" & datDateofBirth.Text & "'"
Case "MedicalDate"
objReport.DataDefinition.FormulaFields(iII).Text = "'" & datMedicalDate.Text & "'"
End Select
Next iII
BTW Take note of what I did at the top where I striped out the ' in any text that you are going to be passing in... It will freak out Crystal if you give it an apostrophe the work around we use is to replace the ' with ~ and then handle that in the Crystal formula for the fields, that is probably not the best way but it works.
Humble Programmer
|
|
|
|
|
Hi
I have some code in vb6 and I am unable to convert into into vb.net can some body help me...
UnRGB picImage.Point(r, c), clrr, clrg, clrb
Private Sub UnRGB(ByVal color As OLE_COLOR, ByRef r As Byte, ByRef g As Byte, ByRef b As Byte)
r = color And &HFF&
g = (color And &HFF00&) \ &H100&
b = (color And &HFF0000) \ &H10000
End Sub
where picimage is the picturebox and clrr,clrg and clrb are the variables for RGB please some one help...
|
|
|
|
|
Before I attempt to give you an answer, or point you in the right direction.
Please confirm that the VB6 code is meant to take one pixel from the picturebox and get the red, green and blue components for the color in that pixel.
Henry Minute
If you open a can of worms, any viable solution *MUST* involve a larger can.
|
|
|
|
|
yes it take one pixel from picturebox and plz also tell me how to write the UNRGB method in vb.net
|
|
|
|
|
The only thing that I would add to Dave Ks' answer (below)
is that you cannot get the pixel from the picturebox, you have to get it from the PictureBox.Image property and cast it to a Bitmap.
Henry Minute
If you open a can of worms, any viable solution *MUST* involve a larger can.
|
|
|
|
|
yes I agree you dear that picturebox does not have getpixel property well that problem has solved now I have trouble to perform this code in vb.net
Private Sub UnRGB(ByVal color As System.Drawing.Color, ByRef r As Byte, ByRef g As Byte, ByRef b As Byte)
r = color And &HFF
g = (color And &HFF00) \ &H100
b = (color And &HFF0000) \ &H10000
End Sub
|
|
|
|
|
You don't need it! Once you have the Color from GetPixel, you already have everything this code does! Check the R, G, and B properties of the Color you got back.
|
|
|
|
|
It's easily done using the methods already built in to the Bitmap class. You don't even need this function. Your're calling this with the color of a pixel already, so you already have the R, G, and B properties of the color.
Dim pixelColor As Color = MyBitmap.GetPixel(x, y)
Dim R As Byte = pixelColor.R
Dim G As Byte = pixelColor.G
Dim B As Byte = pixelColor.B
|
|
|
|
|
but dear what about this code...
Private Sub UnRGB(ByVal color As OLE_COLOR, ByRef r As Byte, ByRef g As Byte, ByRef b As Byte)
r = color And &HFF&
g = (color And &HFF00&) \ &H100&
b = (color And &HFF0000) \ &H10000
End Sub
how i Perform Loggical And operation....
|
|
|
|
|
sarfarazaliqureshi wrote: but dear what about this code...
You have misunderstood.
Dim R As Byte = pixelColor.R
Dim G As Byte = pixelColor.G
Dim B As Byte = pixelColor.B
Is that code
Henry Minute
If you open a can of worms, any viable solution *MUST* involve a larger can.
|
|
|
|
|
Actually it is part of Steganography project and I need to Perform This And operation so that I can Store data at Random ...
r = color And &HFF
g = (color And &HFF00) \ &H100
b = (color And &HFF0000) \ &H10000
|
|
|
|
|
In your VB6 code, all that the UnRGB function did was to extract the red, green and blue values from a color.
and put them into clrr, clrg and clrb
UnRGB picImage.Point(r, c), clrr, clrg, clrb
Private Sub UnRGB(ByVal color As OLE_COLOR, ByRef r As Byte, ByRef g As Byte, ByRef b As Byte)
r = color And &HFF&
g = (color And &HFF00&) \ &H100&
b = (color And &HFF0000) \ &H10000
End Sub
Daves code
Dim R As Byte = pixelColor.R
Dim G As Byte = pixelColor.G
Dim B As Byte = pixelColor.B
does that except he has called clrr R, clrg is now G, and clrb is B.
I explained how to get the pixel in a reply to your earlier post.
You now have enough information to solve your problem.
Do not expect us to write it for you.
Do you realise how complex steganography is? If you are unable to grasp the connection between the answers you have been given here and your VB6 code, then you will not be able to cope with steganography.
You might get a better understanding if you go to the Home page of CP and use the search box to look for steganography. There are loads of articles there. I havn't looked at them all but I would expect there to be some in VB.Net
Good luck!
Henry Minute
If you open a can of worms, any viable solution *MUST* involve a larger can.
|
|
|
|
|
Thanks Friend Your Information is Usefull for me and I know Steganography but u r right not enough thx
|
|
|
|
|
I’m new to VB and WPF and struggling with a SQL query that contains a JOIN. This almost works by there is something not right with the JOIN or SELECT statements. If someone can point me to a resource that contains the proper syntax for statements like the one below, I would be very appreciative. Oh...and I'm using VS2008.
Class Window1
Private db As New cmaDataContext
Private UserView As BindingListCollectionView
Private Sub Window1_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
Dim CMAusers = From a In db.tsmContacts _
Join b In db.tsdContactDetails On _
a.intSystemUserID Equals b.intSystemUserID _
Where a.bitDeleted = "0" _
Select a.vchFirstName, a.vchLastName, a.vchMiddle, b.vchEmail
Me.DataContext = CMAusers
Me.UserView = CType(CollectionViewSource.GetDefaultView(Me.DataContext), _
BindingListCollectionView)
End Sub
Thanks,
Todd
modified on Tuesday, January 13, 2009 12:15 PM
|
|
|
|
|
|
Thanks Mika. That should do it.
TD
|
|
|
|
|
No problem. Just a minor correction. It isn't actually SQL you're using but LINQ[^]. Although the syntax is somewhat similar, the concept is very different.
|
|
|
|