|
yes it's work as super but I wonder how can make cell 1 clear once checked is false where I can add the if and else function. I will try by myself first
thanks so much I spent six hours trying with myself finally I'm done with it oh my God
Private Sub Table1DataGridView_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles Table1DataGridView.CellContentClick
Dim pRowNo As Integer
Dim pstrContents As String
pRowNo = Val(Table1DataGridView.SelectedCells(0).RowIndex.ToString())
pstrContents = Table1DataGridView.Rows(pRowNo).Cells(2).Value
Table1DataGridView.Rows(pRowNo).Cells(1).Value = pstrContents
End Sub
|
|
|
|
|
Hi JohnPayton
I tried to add if function but it doesn't work with me the code without if function work prefect
Private Sub Table1DataGridView_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles Table1DataGridView.CellContentClick
Dim pRowNo As Integer
Dim pstrContents As String
pRowNo = Val(Table1DataGridView.SelectedCells(0).RowIndex.ToString())
If Table1DataGridView.Rows(pRowNo).Cells(0).Value = True Then
pstrContents = Table1DataGridView.Rows(pRowNo).Cells(2).Value
Table1DataGridView.Rows(pRowNo).Cells(1).Value = pstrContents
Else
Table1DataGridView.Rows(pRowNo).Cells(1).Value = ""
End If
End Sub
I need to add if because once cell 0 checked= false then cell1 = clear or "" empty
could please help me with this
modified 14-May-12 4:30am.
|
|
|
|
|
Payton I still need your help where I can add if function
|
|
|
|
|
Morning romo22,
Let me understand what you are doing here....
The way I read your code at the moment is If a user clicks on a Row and Cell 0 (checkbox) is Checked, then the contents of Cell 2 are moved into Cell 1 otherwise you clear the contents of Cell 1
Are you using mouse clicks to Check and UnCheck the checkbox in Cell 0 or is it being populated by a data source?
|
|
|
|
|
"The way I read your code at the moment is If a user clicks on a Row and Cell 0 (checkbox) is Checked, then the contents of Cell 2 are moved into Cell 1 otherwise you clear the contents of Cell 1"
yes that what I want to do
" Are you using mouse clicks to Check and UnCheck the checkbox in Cell 0 or is it being populated by a data source?"
yes I use the mouse clicks to Check and UnCheck the checkbox in Cell 0
|
|
|
|
|
I loaded the code below and it works, it's a little simplistic however by playing around with it I'm sure you can improve your skills by making adjustments.
Private Sub DataGridView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView1.Click
Dim pRowNo As Integer
pRowNo = Val(DataGridView1.SelectedCells(0).RowIndex.ToString())
If DataGridView1.Rows(pRowNo).Cells(0).Value = 1 Then
DataGridView1.Rows(pRowNo).Cells(1).Value = DataGridView1.Rows(pRowNo).Cells(2).Value
Else
DataGridView1.Rows(pRowNo).Cells(1).Value = ""
End If
End Sub
|
|
|
|
|
Hi John thank you for standing with me in this code
I got this error
" Operator '=' is not defined for type 'DBNull' and type 'Integer'."
DataGridView1.Rows(pRowNo).Cells(0).Value = 1
I tried to do something like this
DataGridView1.Rows(pRowNo).Cells(0).Value.Tobit = 1
but I still get the same error notice that I'm working on Visual basic Studio 2010 is ther any difference
|
|
|
|
|
You just have to test if the value is a null first. Using a IsDBNull function call.
http://www.freevbcode.com/ShowCode.asp?ID=5810
or
http://msdn.microsoft.com/en-us/library/tckcces5%28v=vs.71%29.aspx
|
|
|
|
|
|
Please check this link.
It is a tool allow you to convert between C# and VB.Net
Link
|
|
|
|
|
actually how to write this code correctly???
other txtsms not showing..just txtsms.text = seat booked
it just show Seat booked: seat1
only seat 1 show instead of 4 seats..plss help..
For i = 4 To wc
TxtSMS.Text = "Congratulation!! Your ticket succesfully booked. Detail of your tickect:" & vbCrLf & "Cinema: " & Branch & vbCrLf & "Movie title: " & moviename & vbCrLf & "Time: " & timeplaying & vbCrLf
TxtSMS.Text = "Tickect ID: " & randomID & "Pls show your tickect ID to our reception counter to get your tickect. TQ"
TxtSMS.Text = "Seat Booked: " & SplitWord(i).ToString & " "
Next
|
|
|
|
|
You do know that every time you set the value of the Text property it REPLACES the text that is already there, not appends to it, correct?
|
|
|
|
|
ooowwhh.. so how i could write the code to show that all .. actually i know i can use & vbcrlf & "something" something like that...
but my problem is i dont know how to display as this line as you can see on my code before:
"Seat booked: " & splitword(i).tostring
where i = 1 ,2 ,3 and until some number depends on the word count.
for know i only can show only for splitword(1).
i use txtsms.text = txtsms.text & "seat booked: " & splitword(i) but the text "seat booked" also repeated.. so what is the correct code to write??
|
|
|
|
|
Someone else gave you the answer. But, the underlying problem still remains. The problem you ran into a a copmlete lack of experience and very basic knowledge of VB.NET (or any other language). I seriously recommend picking up a beginners book on VB.NET and working through it.
|
|
|
|
|
Something like
TxtSMS.Text = "Congratulation!! Your ticket succesfully booked. Detail of your tickect:" & vbCrLf & "Cinema: " & Branch & vbCrLf & "Movie title: " & moviename & vbCrLf & "Time: " & timeplaying & vbCrLf
TxtSMS.Text += "Tickect ID: " & randomID & "Pls show your tickect ID to our reception counter to get your tickect. TQ"
For i = 4 To wc
TxtSMS.Text += "Seat Booked: " & SplitWord(i).ToString & " "
Next
Programming is work, it isn't finger painting. Luc Pattyn
|
|
|
|
|
it works..thanx so much...
|
|
|
|
|
Happy to help.
Programming is work, it isn't finger painting. Luc Pattyn
|
|
|
|
|
Hello,
I get the following error in run time.
Error message
Unable to cast from a number, the value must be less that infinity.
My code in vb .net visual studio 11
Form load
Me.Client = New DXProf(Me) --Excetion thrown here---
Me.components = New Container
Dim manager As New ComponentResourceManager(GetType(Form1))
DXFramework.m_Icon = DirectCast(manager.GetObject("$this.Icon"), Icon)
DXFramework.LoadInstance(Me.Client, Me)
End Sub
End Sub
Here is the exception detail.
System.InvalidCastException occurred
Message=Unable to cast object of type 'DXProf' to type 'idt.medical.IDXClient'.
Source=DXPro
StackTrace:
at DXPro.Form1.Form1_Load(Object sender, EventArgs e) in C:\VBDXDCURRENT\Functionional No Errors\DXPro\Form1.vb:line 73
InnerException:
Any help would be appreciated.
Michael
|
|
|
|
|
What the (explitive deleted) is "DXProf"?? It's surely not part of the .NET Framework, so it's VERY unlikely anyone is going to know about it.
If it's a third party lirbary, you're best bet for getting help on this problem would be the people who wrote that library.
|
|
|
|
|
Dave,
Thanks for your info,
I am the only one working on this program. The original author is not with us anymore and I a picking up the pieces. I have so so source code and comments and no documentation either.
DXProf is a component in the app that works with externel .dll's. I personally would not have written it that way. But I have deal with what I have.
Thanks for your help.
Michael
|
|
|
|
|
KireronThunderStone wrote: Message=Unable to cast object of type 'DXProf' to type 'idt.medical.IDXClient'.
This message tells you everything you need to know. You are trying to initialise a idt.medical.IDXClient object from a DXProf object, but the two are not compatible.
Programming is work, it isn't finger painting. Luc Pattyn
|
|
|
|
|
|
From this, and your other responses, I get the feeling you do not really understand inheritance and still have no idea what this error is about. You need to look at your class definitions to see why the two are incompatible.
Programming is work, it isn't finger painting. Luc Pattyn
|
|
|
|
|
|
In case that it was you (or someone of your colleagues) to develop that DXProf component, make sure that it inherits from 'idt.medical.IDXClient ' (which might be an interface).
Actually I'd expect the compiler to complain - is there still some kind of "Option Explicit Off" in that version of VB?
|
|
|
|