|
Hai,
Can you help me to add the button column in the datagrid using vb.net2003.
This button i want for the purpose of (When i select one row and if we press enter)i have to close that grid,and goto other Form)..
Thanks,
Hanuman.G
hanuman
|
|
|
|
|
Hello,
I'm not totally familiar with vb.net but I think there's an option in the properties box. Try the layout tab. Then just code the opening of the other form like
Private Sub dgdDataGrid_ButtonClick(ByVal ColIndex As Integer)
Form1.Show vbModal
End Sub
Hope this helps
Aim small, miss small
|
|
|
|
|
For Adding a button to a datagridview first you add a button column to the columns collection.For example I created a buttoncolumn with name "Button".In the column properties i give the text of that column as "Button" and change the property "Use column text For Button Value" as true.
In the DataGridView1_CellClick event write the code below
Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
If DataGridView1.Item(e.ColumnIndex, e.RowIndex).Value Is "Button" Then
MsgBox(DataGridView1.Item(1, e.RowIndex).Value)
Me.Visible = False
Dim obj As New Form2
obj.Show()
obj.TextBox1.Text = DataGridView1.Item(1, e.RowIndex).Value
End If
End Sub
DataGridView1.Item(1, e.RowIndex).Value gives that rows 1st column value.You can use any column of that rows value for the unique identification of that row.Here I passed that value to a TextBox in Form2.
In Form2 with respect to that value you can display the needed informations.
Hope this information clear your doubt.
|
|
|
|
|
Hi All,
I m creating an Application KEYLOGGER. So i want to know that in which application the key has been pressed.
How do I detect which Application get focus at run-time?
Thanks
|
|
|
|
|
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
Hai, i am using VB 6.0. I want to read data from Excel sheet.
While txtStream1.AtEndOfStream <> True
main_str = txtStream1.ReadLine
.............................
Wend
I tried the above method. That does not help me..Pls help...
Balasubramanian K.
|
|
|
|
|
|
|
hi,
iam unable to color the cells of table i did coding like this but not able to get result any one please suggest me where iam doing mistake .
Dim tbl As Table = New Table()
Dim tr As TableRow = New TableRow()
Dim tc As TableCell = New TableCell()
tc.ColumnSpan = 4
tc.RowSpan = 1
tc.Text = "8AM"
tr.Cells.Add(tc)
Table1.Rows.Add(tr)
Dim tc1 As TableCell = New TableCell
tc1.ColumnSpan = 4
tc1.RowSpan = 1
tc1.Text = "9AM"
tr.Cells.Add(tc1)
Table1.Rows.Add(tr)
Dim tc2 As TableCell = New TableCell
tc2.ColumnSpan = 4
tc2.RowSpan = 1
tc2.Text = "10AM"
tr.Cells.Add(tc2)
Table1.Rows.Add(tr)
Dim tc3 As TableCell = New TableCell
tc3.ColumnSpan = 4
tc3.RowSpan = 1
tc3.Text = "11AM"
tr.Cells.Add(tc3)
Table1.Rows.Add(tr)
Dim tc4 As TableCell = New TableCell
tc4.ColumnSpan = 4
tc4.RowSpan = 1
tc4.Text = "12PM"
tr.Cells.Add(tc4)
Table1.Rows.Add(tr)
Dim tc5 As TableCell = New TableCell
tc5.ColumnSpan = 4
' tc5.RowSpan = 1
tc5.Text = "1PM"
tr.Cells.Add(tc5)
Table1.Rows.Add(tr)
Dim tc6 As TableCell = New TableCell
tc6.ColumnSpan = 4
tc6.RowSpan = 1
tc6.Text = "2PM"
tr.Cells.Add(tc6)
Table1.Rows.Add(tr)
Dim tc7 As TableCell = New TableCell
tc7.ColumnSpan = 4
tc7.RowSpan = 1
tc7.Text = "3PM"
tr.Cells.Add(tc7)
Table1.Rows.Add(tr)
here row is not created problem
Dim tr2 As TableRow = New TableRow
Dim trcell As TableCell = New TableCell
Dim i As Integer
Dim MyArray() As Integer = {0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
For i = 0 To 31
If MyArray(i) = 1 Then
trcell.BackColor = Drawing.Color.Green
Else
trcell.BackColor = Drawing.Color.Yellow
End If
tr2.Cells.Add(trcell)
Next
Table1.Rows.Add(tr2)
In above code second row is not displaying please suggest me where iam wrong .
Regards
Rameez
modified on Tuesday, July 29, 2008 1:52 AM
|
|
|
|
|
Don't cross post.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
hi,
i have a server that using tcplistener and define client as tcpclient,
my client is a hardware that convert tcp connection to rs232 connection,
everything fine but after my server application have a problem and crash, it dont close the tcpclient properly where it can be close in my stop server button event, when i open again my server application, it dont detect that client, so, is there any solution to close the tcp client when i load up my application, or something that force etect the client..
im confuse now...
|
|
|
|
|
Hi,
IMO restoring the communication between a client and a server is a client responsibility, the server
could/should not care.
The same is true when the human user uses a browser to visit a website on some server.
So what I would do is implement a timeout/delay/retry mechanism at the client.
The main choice to make now is: lazy connection or eager connection, i.e. should the client
make/restore a connection when it needs to communicate or as soon as possible (which would be
based on a ping-like interrogation of the server).
|
|
|
|
|
Hello,
I am new to WPF and I want to learn it as fast as I can :P i can't wait to give these new 3D effects to the applications I want to create. I found this cool 3d flip feature in this site
http://www.interact-sw.co.uk/iangblog/2007/05/17/wpf-flippable-3D-list[^]
Its purely made in XAML, but i know we can use Visual Studio 2008 and VB.NET to create effects like these... i tried to look for any kind of a tutorial on the net but i didn't get any which could teach me flipping controls in WPF windows in this manner.
If anyone could help me out I would be grateful
thank you
|
|
|
|
|
Maybe if you posted in this[^] forum, you will get the information you are looking for...
|
|
|
|
|
hey thank you.. i didn't realize there might be a different forum for wpf . thanks a ton and sorry for posting in the wrong forum... this was my first post :P
|
|
|
|
|
I have a project that normally loads an activex control. However, if the control isn't available an error is created "...encountered a problem and needs to close". Is it possible to get around this and let the program run even without the control?
Thanks
|
|
|
|
|
cstrader232 wrote: Is it possible to get around this and let the program run even without the control?
Yes, but any dependency on the control in other parts of the program will crash on you. why not ensure the control is always going to be available?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Yes, I understand that I cannot use the control if it's not loaded.
The problem is that some users will not have installed the 3rd party software that supplies the control.
I could I suppose install and register it for them but I don't want to do that because I'm then modifying a control that might be used by still other programs.
Right now, my program looks for the registered control with the appropriate name, because that is what has been added to the form. But if another program modifies or deletes that control, then my program is in trouble.
Is it possible to link a specific control to my program from a specific file at runtime -- ideally without having to register it which could cause problems elsewhere?
Thanks!
|
|
|
|
|
I recalled a greater value than the number of field devices and pagers assigned to the variable ..
Then I've written code design programmatically within a button for ..
I apply fully with me .. But the interface problem .. Come:.
When I click on the button is doing a certain ..
Settled happened button _click and Manf ..
You Code:.
Public WithEvents B As Button
Dim sql_tim As String = "select max(pc_no) from pc "
cmd_pc.Connection = con
cmd_pc.CommandText = sql_tim
n = cmd_pc.ExecuteScalar
====================
Dim x, y,i
x = 269
y = 44
For i = 1 To n
B(i) = New Button
B(i).Location = New System.Drawing.Point(x, y)
B(i).Name = "b" & i
B(i).Size = New System.Drawing.Size(101, 103)
B(i).TabIndex = i
B(i).Text = "open" & i
B(i).UseVisualStyleBackColor = True
B(i).Image = Global.server.My.Resources.Resources.op
B(i).Image = Global.server.My.Resources.Resources.col
B(i).ContextMenuStrip = Me.ContextMenuStrip1
Controls.Add(B(i))
x = x + 130
If i Mod 6 = 0 Then
x = 269
y = y + 120
End If
Next
ــــــــــــــــــــــــــــــــــــــــــــــــــــ
Private Sub B_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles B1.Click
Msgbox("welcom")
End Sub
Required:.
All are doing a certain button for example, show a message ..
|
|
|
|
|
Hey? What? Errmmm, not at all sure what you are saying or what problem you are experiencing and need help with.
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
I wrote a "widget" to report sales data, etc. I need to make some calculations based on business days to date this month. Business days are Mon-Fri, minus any holidays. Holidays are defined in my.settings, using a string collection. The function below iterates through the days of the current month until it reaches today. For each iteration, it checks to see if the day is a weekday, then checks to see if it is listed in my.settings.holidays. If it is a weekday, and not a holiday, the counter is incremented. If it is a holiday I receive a message "Holiday". This works exactly as I expect on my dev machine. However, when running the widget on any other machine, the "IF" statement that checks the holidays never evaluates to true. Any ideas anybody? Am I missing an import statement?
Protected Overridable Function CountBusinessDays() As Integer
Dim BusDays As Integer
Dim RefMonth As Integer = Month(Now)
Dim CalcDate As Date = DateSerial(Year(Now), Month(Now), 1)
Do While Month(CalcDate) = RefMonth
Dim wkday As Integer = Weekday(CalcDate)
If wkday <> 1 And wkday <> 7 Then
If Not My.Settings.Holiday.Contains(CalcDate.ToString) Then
BusDays = (BusDays + 1)
Else : MsgBox("Holiday") 'For testing....
End If
End If
If CalcDate = Date.Today Then Exit Do
CalcDate = CalcDate.AddDays(1)
Loop
Return BusDays
End Function
We use Visual Studio 2005, and have .Net framework 3.5 installed on all machines.
|
|
|
|
|
How is your 'Holiday' setting originally getting populated? I am wondering if maybe the string you expect simply is not in the User.Config on the "other" machine(s). Have you checked the user.config on the other machines to see if that setting is populated?
|
|
|
|
|
Excellent thing to check. However, I have already checked that the holidays are there. The 'Holidays' are pre-populated with some default values at build time. The user can change them at will. The settings are there, I verified this with:
For each st as string in My.Settings.Holidays
msgbox(st)
Next
The messages show the correct dates, which reflect any changes made on the specific machine. I also
have user settings for fore and back colors, window location, etc. which are always applied correctly.
I also tried aggregating all the holidays into one string and search it using 'InStr'. Once again, this worked fine on the dev machine but not others.
Does the problem lie in the fact that I am comparing a "date.tostring" with a "string"? But it does work on the dev machine....
|
|
|
|
|
Does the problem lie in the fact that I am comparing a "date.tostring" with a "string"? But it does work on the dev machine....
That may very well be the problem, since the 'ToString()' can do a default conversion to different formats on different machines. Since you know what the date format used is within the 'Holiday' setting, you should ensure that you convert to that format with ToString. For example, if your Holiday date string format is YYYYMMDD, you could do CalcDate.ToString("yyyyMMdd") in your conditional statement.
|
|
|
|
|
Thanks! That is it. I had tried '.toshortdatestring' and a few others, and none worked. For some reason I never thought of simply formatting the string.
|
|
|
|
|