|
Hi..
I assume that your datagrid has a datasource / datamember one table from a dataset.
if you add a new row to your table then the grid will show the new row as empty textboxes
example
'we asume that you have already a dataset ( named dataset1 ) and in the dataset is a table ( named table1 ).
private sub addrow
Dim newrow As DataRow
newrow = DataSet1.Tables("table1").NewRow
DataSet1.Tables("table1").Rows.Add(newrow)
end sub
this sub adds a row to your table and this row must be shown in the binded datagrid as empty textboxes.
Hope i helped you.
Ramaseb.
|
|
|
|
|
Any body master in Datagrid please Help me...
Datagrid Problem
Hello can any body help
I have a grid which contains textboxes in it, Can any body help as how to add a new row of
blank text boxes within the grid when a button is clicked
Thanks in Advance
Irsh
|
|
|
|
|
I have .msg file( outlook email) and successfully loaded the msg file into
the outlook in the notes folder. However, I can't launch the loaded email.
Here is how I did in order to launch the outlook note.
Dim objNameSpace As Outlook.NameSpace
Dim objMAPIFolder As Outlook.MAPIFolder
Dim objMailItem As Outlook.MailItem
Set objMAPIFolder = objNameSpace.GetDefaultFolder(olFolderNotes)
Set objNoteItem = otlkDoc.CreateItemFromTemplate(str_FileName)
objNoteItem.Move objMAPIFolder
objNoteItem.Save
objNoteItem.Display 1
|
|
|
|
|
hii every one,
i need to convert from the doc file to html..not by using save as in the ms word.. coz it makes problems with the arabic laguage...it will be helpful if i know the structure of the doc file...
any one can help ??
|
|
|
|
|
|
You'll have a difficult time with this one. Your talking about writing an app that can load a .DOC file, the file structure of which is not simple nor easy to interpret, rendering it in a form that you can then go over and convert to HTML and images. This will be FAR from easy and I don't think there is alot of experience out there to help you. You might want to check out the Open Source sites, like SourceForge, and search for a Word document viewer to get you started. I don't know of any projects myself, but that doen't mean they don't exist.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all,
I have a data sheet from rtf file that I read into the excel table so that it looks need. I also have a limit as to the range of these values. Eg. 3 to 7. So if the value in the cell is 9, it is out of range and I am suppose to highlight it in red colour. Any help on this ? I am using Visual Basic, not VBA.
On another question, is there any good Visual Basic example of how to draw a chart without having the program crash during the second time? Thanks in advance.
|
|
|
|
|
I want to return a value from textbox to other form when it opens, how to code the return?
my code:
In FORM1:
file_location = textbox1.text
Private Sub btnView_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnView.Click
Dim view As New frmView
MessageBox.Show(file_location)
If view.ShowDialog() = DialogResult.OK Then
End If
End Sub
Public Property ReturnView() As String
Get
Return file_location
End Get
Set(ByVal Value As String)
file_location = Value
End Set
End Property
In FORM2:
Dim AddJob As New frmAddJob
view = AddJob.ReturnView
TextBox1.Text = view
The problem is the view is nothing..it can't pass the value to form2..
does everybody know what's wrong with code? Thanks for your help..
-----------------------Lisa--------------------------
|
|
|
|
|
If I'm reading this correctly you want to click on a button on form1 which contains a textbox and pass the contents of the textbox to Form2.
Simply set up a module with a variable mvarfile_Location as string. When you click on the button. Set this public/friend module level variable and show form2. In the form2 load event - retrieve the contents of this module level variable mvarfile_Location .
FORM1
*****
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Frm2 As New Form2
mvarFileLocation = TextBox1.Text
MessageBox.Show(mvarFileLocation )
If view.ShowDialog() = DialogResult.OK Then
End If
End Sub
FORM2
*****
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
me.text = mvarFileLocation
End Sub
End Class
Module test
Public mvarFileLocation As String
End Module
Of course you could use a class and properties etc. But basically you are putting the contents into a variable/property etc. accessible from both forms.
Alternatively
You could pass a reference to form2 from form1 and use this to directly access form1.
|
|
|
|
|
Thank you very much! It works perfect!
Lisa
|
|
|
|
|
Hi all..
can i work on a unified screen resolution in order for the views to appear the same. Is there a way to make the views and fonts dynamically adjustable according to the screen resolution in vb.net?
Thanks alot
|
|
|
|
|
I am trying to iterate through a hashtable using an enumerator. I want to change some values as I go.
Here is a simplified version of my code….
ptr = hashTab.GetEnumerator<br />
<br />
While ptr.MoveNext<br />
hashTab.Item(ptr.Key) = "something different"<br />
End While
I get the following exception when I change a value – Collection was modified; enumeration operation may not execute.
What is the correct way to perform this type of operation?
John.
|
|
|
|
|
The problem occurs because you are completely replacing the item in the hashtable. This is not allowed during an enumeration.
If your hashtable contains objects, it is allowed to update properties of those objects. So one solution is to create an object (or type) that contains the string value.
Another solution is to build a new collection, and then discard the old one.
my blog
|
|
|
|
|
Hashtable belongs to readonly dictionary base object. Thu editing the content is not possible.what you can do ir remove the key and add it again with the new value:
hashTab.Remove ptr.Key
then...
hashTab.Add ptr.Key, “something different”
|
|
|
|
|
I'm trying to save a MS Word shape of the type msoDiagram into a separate file and to this end I thought if I could convert the diagram into an image , then I could easily save the image into a file. However I'm unable to figure out a way to convert the diagram into an image - anybody has any idea ?
Smriti
|
|
|
|
|
if you are using MS Office 2003 you can print your document to MS Office Image writer, this will create a YourDocument.mdi file for you after you open it (by double clicking it) you can use the Save as... to save your file as image (YourDocument.tif)
Hope this will help
xiao xiao
|
|
|
|
|
This is my datagrid table:
Entity_id customer phone address
1 name 222
2 name2 333
3 name3 444
button: show entity_id
when you select which row, then that row's entity_id pass to the button, when you click the button, then popup messagebox to tell you what entity_id you select..
is everybody has any idea to do this function?
- Lisa
|
|
|
|
|
Perhaps this is what you are looking for....
Get the current cell's rownumber
and then build string for the messagebox which looks at the appropriate columns on that cell.....
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strTest As String
Dim iRowNumber As Integer
Try
iRowNumber = DataGrid1.CurrentCell.RowNumber()
strTest = "Selected Identify " & CStr(DataGrid1.Item(iRowNumber, 1))
MessageBox.Show(strTest)
Catch ex As Exception
End Try
End Sub
SkyTribe
|
|
|
|
|
thanks SkyTribe..
But that is not I'm dealing with in my appl. I need the entityID whick is clicked to forward to another form to the next SQL: select * from customer where entity_id = entityID...
Lisa
|
|
|
|
|
Then how about this....
Public Class MainForm
Inherits System.Windows.Forms.Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim frm3 As New Form3
With frm3
.ID = TextBox1.Text
.Show()
End With
End Sub
End Class
and a sub form containing a single label control.
Public Class Form3
Inherits System.Windows.Forms.Form
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strTest As String
strTest = "Item Selected = " & mvarID
Label1.Text = strTest
End Sub
Private mvarID As String
Public Property ID() As String
Get
Return mvarID
End Get
Set(ByVal Value As String)
mvarID = Value
End Set
End Property
End Class
With this the contents of textbox (but it could be any items on the mainform are used to set properties on the sub form (frm3) which are then used in frm3.
In this case there is a single label called label1 on the sub form which is set from the contents of the textbox on mainform.
If you wanted to pass a integer then simply change the property to integer. If you wanted to pass a series of integer for say a SQL select statement then you could construct a where clause sting on the main and pass a single string or pass a collection or data structure of integer values to the sub form to be parsed into a sql string.
|
|
|
|
|
This is my code..
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim objConn As String = "Provider=SQLOLEDB;Data Source=server;"
Dim objString As String = "SELECT entity_id, client_number, client_name FROM Companies WHERE status=1"
Dim DA As OleDbDataAdapter
Dim DS As DataSet
Dim conn As New OleDbConnection(objConn)
DA = New OleDbDataAdapter(objString, objConn)
DS = New DataSet
DA.Fill(DS, "Companies")
conn.Close()
DataGrid1.DataSource = DS.Tables("Companies")
'how to get the entity_id when user select client_number row? how to sign the entity = ??
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'messagebox test if pass the right entity_id
MessageBox.Show(entity)
dim form2 as new form2
form2.showdialog()
End Sub
Public Class Form2
Inherits System.Windows.Forms.Form
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim objConn As String = "Provider=SQLOLEDB;Data Source=server;"
Dim objString As String = "SELECT client_number, client_name, contact, phone_number, address, city FROM Companies WHERE status=1 and entity_id = " & entity
Dim DA As OleDbDataAdapter
Dim DS As DataSet
Dim conn As New OleDbConnection(objConn)
DA = New OleDbDataAdapter(objString, objConn)
DS = New DataSet
DA.Fill(DS, "Companies")
conn.Close()
DataGrid1.DataSource = DS.Tables("Companies")
End Sub
Lisa
|
|
|
|
|
With Option Strict On...How do I get a date from a textbox to a variable defined as date?
|
|
|
|
|
myDate = DateTime.Parse(myTextBox.Value)
my blog
|
|
|
|
|
Generaly when the option stict on is set you can convert value's on two way's
1- use the ctype like
Dim MyDate as Date
MyDate = cType(me.textBox1.text, Date)
2- Using the Cast method.
I must check some things how that is working I never needed yet.
I respond on this later.
|
|
|
|
|
Hi everyone
I need help about how can I integrate 2 project. I have one project doing one thing (reports issues) and the other project doing other thing (security managements).
Right now this 2 project running well but independend, I want to modify the second project for calling any project i want. but in don't know how do that..
Please help me on that..
Johnny Lizardo
|
|
|
|