|
Thanks a lot it's working
Hitesh sojitra
|
|
|
|
|
one more quiry please
if i wants insert 3 row after A5 than it is (5:3) ? or any thing else?
Hitesh sojitra
|
|
|
|
|
thanks i got it..............
Hitesh sojitra
|
|
|
|
|
hi
i am using data binding and this is my code
Imports System.Drawing.Printing<br />
<br />
<br />
Public Class Form2<br />
Public ConStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _<br />
"Data Source =" & Application.StartupPath & "\ITDSS.mdb"<br />
Public con As New OleDbConnection(ConStr)<br />
Dim DataSet1, course As New DataSet<br />
'Dim SQLstr = "SELECT SectionID,Type,Group,TeacherID from [Section]"<br />
Dim SQLstr = "SELECT DISTINCT s.LevelNo, c.CourseID,c.SectionID,c.Type,c.Group, r.RoomID FROM [Section] c,Course s,[Slot] r where s.CourseID=c.CourseID and c.SectionID=r.SectionID ORDER BY s.LevelNo" ' in(select CourseID from Course Where LevelNo=1)" 's,Course c WHERE s.CourseID = c.CourseID ORDER BY c.LevelNo"<br />
<br />
Dim DataAdapter1 As New OleDb.OleDbDataAdapter(SQLstr, con)<br />
<br />
'----------------------===============================<br />
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
Dim SQLstr, SQLstr1 As String<br />
<br />
'Dim DataSet1, course As New DataSet<br />
'SQLstr = "SELECT SectionID,Type,Group from [Section]"<br />
Con.Open()<br />
<br />
'DataAdapter1 = New OleDb.OleDbDataAdapter(SQLstr, con)<br />
<br />
<br />
DataAdapter1.Fill(DataSet1, "Section")<br />
<br />
Me.DataBindings.Add("text", DataSet1, "Section.SectionID")<br />
<br />
DataGridView1.DataSource = DataSet1<br />
DataGridView1.DataMember = "Section"<br />
<br />
<br />
Dim bmb As BindingManagerBase<br />
bmb = Me.BindingContext(DataSet1, "Section")<br />
bmb.Position = bmb.Count<br />
bmb.Position = 0<br />
end sub
and i want to update it when button press
i but the flowing code
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click<br />
Dim CmdB As New OleDb.OleDbCommandBuilder(DataAdapter1)<br />
DataAdapter1.Update(DataSet1, "Section")<br />
<br />
End Sub<br />
End Class
but it give error update statement
please i need help
|
|
|
|
|
Um where is your update script!, I can see your select but no update
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I have created a control that is basically an TextBox with an extra property of RegularExpression
Public Class RegExTextBox<br />
Inherits from Windows.Forms.TextBox<br />
<br />
Private _sRegEx As String<br />
<br />
Public Property RegularExpression() As String<br />
Get<br />
Return _sRegEx<br />
End Get<br />
Set(ByVal Value As String)<br />
_sRegEx<br />
End Set<br />
End Property<br />
After text has been entered then text is then validated against the provided Regular Expression
Private Sub RegExTextBox_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Leave<br />
If Not System.Text.RegularExpressions.Regex.IsMatch(MyBase.Text, _sRegularExpression) Then<br />
Throw New TextDoesNotMatchRegularExpressionException()<br />
End If<br />
End Sub
The problem that I am not sure how to trap the error on the form that consumes the RegExTextBox.
The only solutions I could come up with is to have another readonly property the returns true or false depending on whether the text is valid
Public ReadOnly Property IsValidText() As Boolean<br />
Get<br />
Return System.Text.RegularExpressions.Regex.IsMatch(MyBase.Text, _sRegularExpression)<br />
End Get<br />
End Property
Then delete the Leave event handler from the control and test the IsValidText property at form level.
Any guidance is appricated
Thanks
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
A possible soloution could be to create your own custom event for when the value doesn't match the regex:
In your control
Public event InvalidData(Sender as Object)
Private Sub RegExTextBox_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Leave
If Not System.Text.RegularExpressions.Regex.IsMatch(MyBase.Text, _sRegularExpression) Then
Raise Event InvalidData(Me)
End If
End Sub
and in your main form:
Private sub InvalidRegexText(byval sender as object)
if typeof(sender) is RegExTextBox) then
with directcast(sender, RegExTextBox)
do whatever you need here
end with
end if
end sub
(p.s. the code may not be exactly correct - I havent tested it, but the theory is right)
|
|
|
|
|
I can be dim sometimes. It's not like I've never done it before.
I'm off to kick myself now.
Thanks
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
is there any way to compress file in vb .net 2003 without using outside reference?
|
|
|
|
|
You could reference vjslib which should be listed under the .NET tab of the Add Reference dialog box.
The should then explore the java.util.zip namespace.
The only thing is, I as not sure it is available in the .NET Framework 1.x, but is available in .NET Framework 2
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
I found the following article on CodeProject which may be of help http://www.codeproject.com/KB/recipes/cpzipstrip2.aspx[^]. It's in C# but should give you some pointers.
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
i need to center align text when printing.( using Printer.print )
Thanks & Regards
|
|
|
|
|
I don't think that it is possible when printing, you have to use printer.currentX to position your cursor and do not forget to take in consideration the lenght of the sentence you write using textwidth
Hope it was helpful
Shay Noy
|
|
|
|
|
I would like to create a open file dialog that can display multiple images in 1 single click. However, i only manage to select an image in 1 time. Could anyone please teach me how to select multiple image per open file dialog? Thanks so much!
Dim OpenFile As OpenFileDialog = New OpenFileDialog
Dim ImgName() As String
Dim LoopCtrl As Integer
OpenFile.Filter = "JPG Images|*.JPG|Bitmaps|*.BMP|GIF Images|*.GIF|All Images|*.BMP;*.GIF;*.JPG"
OpenFile.FilterIndex = 10
OpenFile.Multiselect = True
If OpenFile.ShowDialog = Windows.Forms.DialogResult.OK Then
ImgName = OpenFile.FileNames
For LoopCtrl = 0 To ImgName.Length - 1
objImage(LoopCtrl) = Image.FromFile(ImgName(LoopCtrl))
Next
OriginalPic.Image = objImage(0)
OriginalPic1.Image = objImage(1)
End If
This is how i write the code. Could anyone please kindly teach me how to select multiple image per open file dialog? Thanks so much!
|
|
|
|
|
The code which you have written is correct.
This will allow you to open a FileOpen dialog box. In this dialog box you may select multiple image files either by holding down control key, while selecting files or you may simply click on any empty area of dialog box and drag your mouse to select multiple files.
In case if you are facing any problem in selecting multiple files, let us know.
-Ajay.
-------------------------
www.componentone.com
-------------------------
|
|
|
|
|
First of all, thanks for reply. I was holding down the control key while selecting file, but it appeared that the file name changed and only 1 selected instead of both filenames appeared. Any solution to it? Thanks!
|
|
|
|
|
I used same code which has been given by and it is showing two different images on two different picture boxes.
However I would like to inform you about one thing,when we select multiple files using Cntrl key, sequence of file names get changed.
Therefore if you first click on ‘img1.jpg’ then img2.jpg’, it will become ‘img2.jpg’ ‘img1.jpg’.
Therefore make sure that this fact is not creating any confusion.
You may also get into debug mode and check value of ImgName to see how many file names are listed there.
At my end I am getting correct number and list of files.
-Ajay.
-------------------------
www.componentone.com
-------------------------
|
|
|
|
|
Thanks..now i can select multiple file but it appeared some error lines. For the below coding
For LoopCtrl = 0 To ImgName.Length
objImage(LoopCtrl) = Image.FromFile(ImgName(LoopCtrl))
Next LoopCtrl
It come out error "Object reference not set to an instance of an object". How i can solve it?
|
|
|
|
|
Make it -
For LoopCtrl = 0 To ImgName.Length-1
objImage(LoopCtrl) = Image.FromFile(ImgName(LoopCtrl))
Next LoopCtrl
-----------
If you are selecting two files, ImgName.Length will be 2, however index for two elements would be 0 and 1.
Therefore we need to run loop from 0 to ImgName.Length-1.
-Ajay.
-------------------------
www.componentone.com
-------------------------
|
|
|
|
|
Sorry for the trouble, it seems the same problem occur although i changed it as u have stated. Is there any other error?
Dim OpenFile As OpenFileDialog = New OpenFileDialog
Dim ImgName() As String
Dim LoopCtrl As Integer
OpenFile.Filter = "JPG Images|*.JPG|Bitmaps|*.BMP|GIF Images|*.GIF|All Images|*.BMP;*.GIF;*.JPG"
OpenFile.FilterIndex = 10
OpenFile.Multiselect = True
If OpenFile.ShowDialog = Windows.Forms.DialogResult.OK Then
ImgName = OpenFile.FileNames
For LoopCtrl = 0 To ImgName.Length - 1
objImage(LoopCtrl) = Image.FromFile(ImgName(LoopCtrl))
Next LoopCtrl
OriginalPic.Image = objImage(0)
OriginalPic1.Image = objImage(1)
End If
|
|
|
|
|
What are OriginalPic and OriginalPic1?
I also don’t see any declaration of objimage array in your code.
Therefore I would like to how it is being declared and what is size of this array.
In my code its declared as -
Dim objimage(10) As Image
-Ajay.
-------------------------
www.componentone.com
-------------------------
|
|
|
|
|
Finally get it right. What a mistake i make! Thanks for help!!
|
|
|
|
|
Hello every one..
I am having a VB 2005 application.. Can i use a nested try and catch...
i.e can i have another try can catch block inside a catch block..
I will tell what want to achieve
My application has a distributed DB on 1-4 DB servers (Configurable)
I am reading the Primary Server IP from a text file and then read the remaining servers IP from the setting table in Primary server...
In a single system setup what i am doing is accessing the DB on the network path...
But when the network is down the i will like to access the same DB as local host
The structure is
'get network IP
Tyr
conn.open
catch
'get alternate server IP
conn.open
end try
My intention is to do error handling of second attempt to connect also. So i wanted to put a try and catch block in catch block
Is there any other or better way
Regards
Nishkarsh
|
|
|
|
|
Yes you can but why not put the connection creation in a seperate method and return the connction or nothing, then test the return value and try again if it is nothing
Dim oCon as SQLConnection = nothing
do while ocon is nothing or i > counter
ocon = create connection(sip)
if not ocon is nothing then
exit for
end if
loop
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I am a newbie to VB platform... i wanted to write a program that can compare two text files and display the common strings along with the number of times the strings are found and the line number !
I heard can use string parsing to do the job.Can anyone help me with some codes ,really appreatiate your help.
|
|
|
|