|
Syed Wayez Ahmed wrote: Any suggestion will be most appreciated.
Look at the CodeProject articles here[^], search Google for "live chat".
It's time for a new signature.
|
|
|
|
|
Thank You for your suggestion, I dnt know what is google before. You have given me a valuable suggestion.
|
|
|
|
|
Syed Wayez Ahmed wrote: Thank You for your suggestion, I dnt know what is google before. You have given me a valuable suggestion
There is no point your being sarcastic here.
It's ok that you knew about Google.
But did you do a search on it before posting this question here?
|
|
|
|
|
Did you check the CodeProject articles? Your question is one of the most common posted on this website: at least once every week. And always by people who appear too lazy to do some simple simple research for themselves.
It's time for a new signature.
|
|
|
|
|
Hi Richard!
Thnx for your replies. It seems u r angry now, being angry whn made to is quality of definately Male.
I did research and found many articles which point me to use activex which i dnt want to. and i want an ajax and saved chat can you suggest me for the same?
|
|
|
|
|
Syed Wayez Ahmed wrote: It seems u r angry now, being angry whn made to is quality of definately Male.
I apologise if I misunderstood your previous message. However your use of 'txtspk' rather than proper spelling makes it difficult to understand what you are saying.
Syed Wayez Ahmed wrote: and i want an ajax and saved chat can you suggest me for the same? Roll eyes
Same answer as before, look at the articles and search Google, this is such a common question there are many answers to be found. Select the one that best suits your knowledge and experience.
It's time for a new signature.
|
|
|
|
|
Hey Richard!
Thanx Again. Am on it(Looking for the articles in google), but if any article in your view is best, let me know ?
|
|
|
|
|
Hi, dear all,
I create a MDIContainer form (called form1) which has a TreeView on the left side, the treeview looks like and is designed at design mode:
+ Input Data
Primary Data
+ Object Data
Object 1
Object 2
Object 3
The Object number is 2 or 3, so by default I create 3 nodes, one for each object, my problems are:
1: Based on user selection about object number (2 or 3), I will decided remove (or disable or hide) Object 3 treenode, if user change the value to 3, I will add (or enable or show) this node. But I didn't find any information about disable treenode, can I disable treenode? If I use remove node, when I decide to add it back later, how can I make sure it is added at the same locatin in treeview?
2: if the user selection is stored in DB, then next time when he open the form, the object node number should be same as user selected object number, but from where I should initialize the treeview? Since the treeview is in form1 (MDI container), I thought I can do it at form1_Load() subroutine, but when I check the treenode count in it (using TreeView1.Nodes.Count),but I got value 1 instead of 6, why???
Thanks!
|
|
|
|
|
|
If you solved it yourself please post the solution so that others who have the same problem in the future can benefit from the solution as well.
|
|
|
|
|
Ok, maybe it's not an issue for most of you, but for new user like me, it may help.
When you get the node count using TreeView1.Nodes.count, it return the count of the root nodes directly under the TreeView, it doesn't include the node under subtree. If you want to get all node under TreeView, use TreeView1.GetNodeCount(True), here True means including all the nodes in subtree.
|
|
|
|
|
I have an urgent question about the datagridview and combobox column in VB2005
I am unable to show the first item in the award code field by default without selecting an item first. How can this be done?
For example CX should be shown in the blank area for the first 2 items, which shows up as blank. The 2nd issue is how can I take the data from my hidden field, which has an award code of either cd,cn,mr, etc, which is brought back in the dataset below and is on the grid but the column is just hidden. I actually need this data shown as the default in the “blank space” of the combobox. I am at a loss. So basically when I load the grid I need the award code for a specific row placed into the combo box as if it were selected for that specific row by default. So row 1 would show the following:
Row 1 would show Transfer =blank Rfa number CX08-004 Award Code=CD
Row 2 would show Transfer =blank Rfa number CX08-003 Award Code=RP
etc
etc
Below code is what I use to bind the datasource to the combo box
With grdBatchBudgetProjection ‘Dataviewgrid
With chk ‘CheckboxColumn
.DataPropertyName = "AwardCD"
.HeaderText = "Award Code"
.Width = 100
' Bind Column
.DataSource = ds3.Tables(0)
.ValueMember = "AwardID" ‘also tried AwardCD here
.DisplayMember = "AwardCD"
.DisplayStyle = DataGridViewComboBoxDisplayStyle.ComboBox
'dd or cbo, doesn't really matter for this field.
End With
.Columns.Add(chk)
End With
-----------------
I also tried the below code with no success. i just cannot see what I am doing incorrectly.
<pre>'Kludge loop to have combo box index= value returned from sql
'For iRowCount = 0 To ds2.Tables(0).Rows.Count - 1
Dim j As Integer = 0
For Each row As DataGridViewRow In grdBatchBudgetProjection.Rows
'' Dim Cell As DataGridViewComboBoxCell = DirectCast(grdBatchBudgetProjection.Item(5,j),
DataGridViewComboBoxCell)
Dim cell As DataGridViewComboBoxCell = DirectCast(grdBatchBudgetProjection.Item(5, j),
DataGridViewComboBoxCell)
cell.Value = ds2.Tables(0).Rows(j)(4).ToString
'Debug.Print(ds2.Tables(0).Rows(j)("AwardCD").ToString)
'grdBatchBudgetProjection.Rows(j).Cells(5).Value = ds2.Tables(0).Rows(j)
("AwardCD").ToString
j = j + 1
Next</pre>
Thank You for your time
|
|
|
|
|
Hi,I have a problem, the following piece of code will search only one field, but I would extend it to two fields (name + surname).
Unfortunately this is the first Windows Forms application that I make, are usually used to program in C # for web applications!
Thanks for your help!
Private Sub Command1_Click()
Dim NomeDaCercare As String
NomeDaCercare = InputBox$("Enter the name to search:", "Ricerca clienti")
If NomeDaCercare <> "" Then
Data1.Recordset.Index = "Nome"
Data1.Recordset.Seek "=", NomeDaCercare
If Data1.Recordset.NoMatch Then
Data1.Recordset.MoveFirst
Data1.Refresh
MsgBox "Name not found", vbInformation, Me.Caption
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
End If
End If
End Sub
|
|
|
|
|
I found this in the Microsoft Knowledge Base which may help you:
ADO Find method only supports one criteria[^]
That is assuming you are using ADO. May I suggest that you create a couple of Text Boxes on your form into which the user can enter the two names for the search criteria. Then in the Command1_click routine you can take the input from the boxes (after validating) to build the filter.
It’s not because things are difficult that we do not dare, it’s because we do not dare that things are difficult. ~Seneca
|
|
|
|
|
I have this code which is getting me most of the properties except the size of the field!
Private Sub Props()
Dim sSql As String = "SELECT * from MyTable"
Dim da As New SqlClient.SqlDataAdapter(sSql, conSQL)
conSQL.Open()
Dim ds As New DataSet
da.Fill(ds)
Dim sb As New StringBuilder
Dim tbl As DataTable = ds.Tables(0)
For Each col As DataColumn In tbl.Columns
myProperties(0) = col.DataType.ToString()'I get correct values here
myProperties(1) = col.MaxLength.ToString()' this return -1 for chars and varchars
Next
End Sub
Could someone help me to get the size of the fields, eg if the field is 50 varchar, etc. Or a better way to help me get it if this code is not the proper way.
Thanks
|
|
|
|
|
Dim sSql As String = "SELECT * from MyTable"
Dim da As New SqlClient.SqlDataAdapter(sSql, conSQL)
da.MissingSchemaAction = MissingSchemaAction.AddWithKey
conSQL.Open()
Dim ds As New DataSet
da.Fill(ds)
Source[^]
I are Troll
|
|
|
|
|
|
You're welcome
|
|
|
|
|
Hi,
I use Visual Basic 2005 from Visual Studio 2005. I read from some artical that TextBox control should have contextmenu property, but I cannot find ContextMenu property (only ContextMenuStrip) in property window, but I can see it from the object attribute like TextBox1.ContextMenu.
Also from ToolBox, I cannot fild ContextMenu control.
Is this nomal?, if now, how can I let it be shown?
Thanks!
|
|
|
|
|
Isn't it called ContextMenuStrip? It is in the 'Menus & ToolBars' group. if you dont see it you can select 'All Windows Forms' group. I guess you are probably looking for 'ContextMenu', it is called ContextMenuStrip.
Hope this helps
|
|
|
|
|
Thanks for reply.
So I should use ContextMenuStrip instead of ContextMenu, right? I saw it.
|
|
|
|
|
|
Hi
I am trying to get the primary field name and the fields that relate to external tables (foreign fields) when i pass in the name of an access table.
something like this:
Private Sub GetPKFK(ByVal myTable as DataTable)
'code here to tell me the PK field and all FK fields in it
'would be great if I also get the names of tables the table/FK's relate to
End Sub
I am able to do this using Typed DataSets for SQL, ie using some very complicated/combination of SQL statements, which obviously can't work with Access.
I read a lot about DataRow.ChildRelation and DataRow.ParentRelations and get codes like this which return nothing when i pass in tablename ...
Private Sub GetPKFK(ByVal myTable as DataTable)
Dim myRelation As DataRelation
Dim arrRows() As DataRow
Dim myRow As DataRow
Dim i As Integer
Dim myColumn As DataColumn
For Each myRelation In myTable.ChildRelations
For Each myRow In myTable.Rows
arrRows = myRow.GetChildRows(myRelation, DataRowVersion.Proposed)
' Print values of rows.
For i = 0 To arrRows.GetUpperBound(0)
For Each myColumn In myTable.Columns
Console.WriteLine(arrRows(i)(myColumn))
Next myColumn
Next i
Next myRow
Next myRelation
End Sub
Thanks for your help
|
|
|
|
|
|
Hi,
I have the below code for transferring file from a client to server. This code works fine but i wanted to know how can i get the file name when i send a file from client to server.when i send a file from client to server a save file dialog will be opened and you i have to write the file name and its extension in order to save it. but i want to get the file name and its extension as it is sent.
//client
Imports System.Threading
Imports System.Net.Sockets
Imports System.Net
Imports System.Text
Imports System.IO
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub btBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btBrowse.Click
OpenFileDialog.ShowDialog()
tbFilename.Text = OpenFileDialog.FileName
End Sub
Private Sub btSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btSend.Click
Dim filebuffer As Byte()
Dim filestream As Stream
filestream = File.OpenRead(tbFilename.Text)
ReDim filebuffer(filestream.Length)
filestream.Read(filebuffer, 0, filestream.Length)
Dim len As Long = filestream.Length - 1
For i As Long = 0 To len
If i Mod 1000 = 0 Then 'only update UI every 1 Kb copied
ProgressBar1.Value = i * 100 / len
Application.DoEvents()
End If
Next
ProgressBar1.Value = 0
Dim IpHost As IPHostEntry
IpHost = Dns.GetHostByName(tbServer.Text)
Dim clientSocket As New TcpClient(tbServer.Text.ToString, 1234)
Dim networkStream As NetworkStream
networkStream = clientSocket.GetStream()
networkStream.Write(filebuffer, 0, filestream.Length)
End Sub
End Class
///server
Imports System.Threading
Imports System.Net
Imports System.Net.Sockets
Imports System.Text
Imports System.IO
Public Class Form1
Inherits System.Windows.Forms.Form
Dim test = System.Net.IPAddress.Any
Private alSockets As ArrayList
Public Sub listenerThread()
Const portNumber As Integer = 1234
Dim tcpListener As New TcpListener(test, portNumber)
Dim handlerSocket As Socket
Dim thdstHandler As ThreadStart
Dim thdHandler As Thread
tcpListener.Start()
Do
handlerSocket = tcpListener.AcceptSocket()
If handlerSocket.Connected Then
lbConnections.Items.Add( _
handlerSocket.RemoteEndPoint.ToString() + _
" Connected.")
SyncLock (Me)
alSockets.Add(handlerSocket)
End SyncLock
thdstHandler = New ThreadStart(AddressOf _
HandlerThread)
thdHandler = New Thread(thdstHandler)
thdHandler.Start()
End If
Loop
End Sub
Public Sub HandlerThread()
Dim handlerSocket As Socket
handlerSocket = alSockets(alSockets.Count - 1)
Dim networkStream As NetworkStream = New _
NetworkStream(handlerSocket)
Dim blockSize As Int16 = 1024
Dim thisRead As Int16
Dim dataByte(blockSize) As Byte
SyncLock Me
Dim SaveFileName As String = String.Empty
Dim DialogSave As New SaveFileDialog
MessageBox.Show("You have a File", "File transfer", MessageBoxButtons.OK, MessageBoxIcon.Warning)
If MsgBoxResult.Ok Then
Me.Opacity = 100
DialogSave.Filter = "All files (*.*)|*.*|JEPG (*.jpg)|*.jpg"
DialogSave.RestoreDirectory = True
DialogSave.Title = "Where do you want to save the file?"
DialogSave.InitialDirectory = "C:/"
If DialogSave.ShowDialog() = DialogResult.OK Then
SaveFileName = DialogSave.FileName
End If
End If
Dim filestream As Stream
filestream = File.OpenWrite(SaveFileName)
While (True)
thisRead = networkStream.Read(dataByte, _
0, blockSize)
If thisRead = 0 Then Exit While
filestream.Write(dataByte, 0, blockSize.ToString)
End While
filestream.Close()
End SyncLock
lbConnections.Items.Add("File Written")
handlerSocket = Nothing
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Opacity = 0
Dim IpHost As IPHostEntry
IpHost = Dns.GetHostByName(Dns.GetHostName())
Label1.Text = "IP Address Is " + _
IpHost.AddressList(0).ToString()
alSockets = New ArrayList
Dim thdListener As New Thread(New ThreadStart _
(AddressOf listenerThread))
thdListener.Start()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Opacity = 0
End Sub
End Class
|
|
|
|
|