|
Hi guys an gals,
I have a form using databinding to a dataset. Whenever the user navigates to another record I check if datasource.HasChanges is true, and if so I ask whether the user wants to save changes. All this works perfect on my pc, but on the users' pcs it basically asks to save on EVERY navigate and even form load, even though there were NO changes made.
Here is the code snippet:
Private Sub OrganisationBindingSource_CurrentChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles OrganisationBindingSource.CurrentChanged<br />
Try<br />
If Me.OrganisationBindingSource.DataSource.HasChanges = True Then<br />
If (MessageBox.Show("Record has changed. Save changes?", "Save", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) = Windows.Forms.DialogResult.Yes) Then<br />
Me.OrganisationBindingSource.EndEdit()<br />
Me.SoftwareBindingSource.EndEdit()<br />
Me.ContactBindingSource.EndEdit()<br />
Me.QuoteBindingSource.EndEdit()<br />
Me.OrganisationTableAdapter.Update(Me.CRMDataSet.Organisation)<br />
Me.SoftwareTableAdapter.Update(Me.CRMDataSet.Software)<br />
Me.ContactTableAdapter.Update(Me.CRMDataSet.Contact)<br />
Me.QuoteTableAdapter.Update(Me.CRMDataSet.Quote)<br />
Else<br />
Try<br />
Me.OrganisationBindingSource.CancelEdit()<br />
Me.SoftwareBindingSource.CancelEdit()<br />
Me.ContactBindingSource.CancelEdit()<br />
Me.QuoteBindingSource.CancelEdit()<br />
Me.OrganisationBindingSource.DataSource.RejectChanges()<br />
Catch<br />
End Try<br />
End If<br />
End If<br />
Catch err As Exception<br />
MessageBox.Show(err.ToString.Replace("'", ""))<br />
DH.RunQuery("INSERT INTO Log_Error (Message, Process) VALUES ('" & err.ToString.Replace("'", "") & "', '" & Me.Name & "')")<br />
End Try<br />
End Sub
Any ideas on what could cause this? As I say, this does not happen on my pc, so I dont know how to debug it???
Thanks in advance
Ed
|
|
|
|
|
Hi Ed,
This code snippet shows the code that gets executed when the user navigates. You say that this code gets executed at the wrong time (also). So it seems to me that you're looking in the wrong place. If you debug this it will always run correctly, and apparently also on the other pc. You will have to look at the code that precedes the navigation event. Somewhere a piece of code is triggering the event or allowing some user action or background process, which your pc does not allow, either by configuration or because of some program that is running on either pc.
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi to all
Please tell me how i will handle this code in vb.net
the code is there in vb and i am converting that into .net
<br />
Dim oFSO As New FileSystemObject<br />
If oFSO.FolderExists("C:\recordedFiles") = False Then oFSO.CreateFolder ("C:\recordedFiles")<br />
If oFSO.FolderExists("C:\recordedFiles\TataAig") = False Then oFSO.CreateFolder ("C:\recordedFiles\TataAig")<br />
<br />
Filename = agent_login_Name & ApplicationNumber & "_" & Format(Now, "YYYYMMDD_HHmmss") & ".Wav"<br />
filePath = "c:\RecordedFiles\TataAig\" & Filename<br />
<br />
Shell App.Path & "\Harddisk.exe -preset " & Chr(34) & App.Path & "\LameCfg.hdp" & Chr(34) & " -record -output " & Chr(34) & filePath & Chr(34) & " -minimize"<br />
<br />
g_FL_Recording_Started = True<br />
lblRecordingStatus = "ON"<br />
cmd_Start.Enabled = False<br />
cmd_stop.Enabled = True<br />
Call log_error("Start Recording ")<br />
|
|
|
|
|
Look at the System.IO.File and System.IO.Directory namespaces where you will find things like
System.IO.Directory.Exists(myFolder)
and
System.IO.Directory.Create(myFolder)
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|
hi all ,
How to get the MAC address
Is there any need to create a new class??
please explain me in detail with coding.
i vl be thankful to u .
regards,
saravan
|
|
|
|
|
I'm not 100% on this, but I'm pretty sure you can do this through WMI.
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed.
Lotus Notes is a conspiracy by the forces of Satan to drive us over the brink into madness. The CRC-32 for each file in the installation includes the numbers 666." Gary Wheeler
"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." - Rick Coo
|
|
|
|
|
Your should try Googling your question[^]before you post them here.
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|
Thanks Steve, that was brilliant.
|
|
|
|
|
In my Application VB.Net and I am going to cerate combo box,
It is behavior like a windows O.S using run command.
Combo Box is having some data many rows,
If user type “c” it is come listed “c” order word
Franics K Antony
|
|
|
|
|
Check out the articles for the autocomplete comboboxes.
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed.
Lotus Notes is a conspiracy by the forces of Satan to drive us over the brink into madness. The CRC-32 for each file in the installation includes the numbers 666." Gary Wheeler
"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." - Rick Coo
|
|
|
|
|
Hi ,
i want this 'Datatype' property as combobox in propertygrid .
-- Datatype
-- Date (Sub Property)
-- Text (sub Property)
-- Number (sub Property)
--Format -
On selecting type of sub-property in combobox the things should be appear in next property ' Format '
if Date is selected ,' dd-mm-yyyy ' should appear .
If Text is selected , nothing should appear.
if NUmber is selected,' 12345 ' should appear in Format property .
Vb8.0
|
|
|
|
|
Try this format
dd-MMM-yyyy
Franics K Antony
|
|
|
|
|
Try setting your Property DataType as an Enum. For example :-
Enum DataTypes<br />
Date=1<br />
Text=2<br />
Number=3<br />
End Enum<br />
<br />
Property DataType As DataTypes<br />
Get<br />
'Your code here<br />
End Get<br />
Set(ByVal Value As DataTypes)<br />
'Your code here<br />
End Set
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|
Thanks
Here it's not taking Date as a type of enum . Rising error 'at the place of Date
" Statement cannot appear within a enum body " .
|
|
|
|
|
Sorry, the example should have read :-
Enum DataTypes<br />
[Date]=1 '<--- Note the square brackets<br />
Text=2<br />
Number=3<br />
End Enum<br />
<br />
Property DataType As DataTypes<br />
Get<br />
'Your code here<br />
End Get<br />
Set(ByVal Value As DataTypes)<br />
'Your code here<br />
End Set
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|
Thanks ,
Now i am able to show the Datatypes .
Now if i select the DataType "Date" then in Text property of Propertygrid , I want to show the datetimepicker .If not i want to show nothing .
For this i used ....
Public Class MyDate<br />
Inherits UITypeEditor<br />
Dim CustomDate As DateTimePicker<br />
Public Overrides Function EditValue(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal provider As System.IServiceProvider, ByVal value As Object) As Object<br />
CustomDate = New DateTimePicker<br />
CustomDate.Format = DateTimePickerFormat.Custom<br />
CustomDate.CustomFormat = "d-MMM-yyyy"<br />
CustomDate.ShowUpDown = True<br />
CustomDate.Show()<br />
Return MyBase.EditValue(context, provider, value)<br />
End Function<br />
Public Overrides Function GetEditStyle(ByVal context As System.ComponentModel.ITypeDescriptorContext) As System.Drawing.Design.UITypeEditorEditStyle<br />
Return UITypeEditorEditStyle.DropDown<br />
End Function<br />
it is showing the dropdown ,but not getting the Datetimepicker .
After selecting the date i want to show in Text Property .
For this what i have to follow ??????????
VB 8.0
|
|
|
|
|
Does any body know how to change to height of the textbox?
Do we have to use any API's to do that?
Any idea or link??
|
|
|
|
|
Hello,
There is no option to change the height of TextBox in .Net. But,
there are other options using which you can change the height.
1. You can set the 'MultiLine' property to True. However, this will
cause the text to wrap into multiple lines.
2. Another option is to increase the font of the Textbox. This will
automatically set the height of the Textbox.
I hope this answers your query.
Regards,
Allen
Allen Smith
Software Engineer
ComponentOne LLC
www.componentone.com
|
|
|
|
|
Hello every one
I am having a VB 2005 application and using “DrawString” to print a bill.
I want is to print the amount in floating point format, with decimal point like “56.00” instead of “56”
I am using floating points variables but when I am changing it into string, to sent it for printing “.00” will is lost
Also I wanted the numeric columns to be right aligned which I am not able to do
Can any one give me a idea how to do it..
Regards
Nishkarsh
|
|
|
|
|
Convert the value to a string format in the DrawString Method:
DrawString(Format(value,"0.00"),...)
This will ensure the format you want.
I don't speak Idiot - please talk slowly and clearly
|
|
|
|
|
Thanks for ur help. It is working.
Any idea how to align the text to right?
The numbers I am printing for amount should be right aligned.
In case of DrawString i can just tell the starting, i.e. only the left most point. How do I do that?
|
|
|
|
|
To align the text you have to set up a StringFormat object:
Dim sf As New StringFormat<br />
sf.Alignment = StringAlignment.Far<br />
sf.LineAlignment = StringAlignment.Center<br />
<br />
DrawString(Format(value,"0.00"),fnt, Brushes.Black,rectF,sf)
(I cant remember if the LineAlignment and Alignment properties are around the right way but a little trial and error will sort this out.)
Cheers
I don't speak Idiot - please talk slowly and clearly
|
|
|
|
|
To format a number as money use: YourDecimalOrFloatOrDoubleOrWhatEver.Tostring("F")
If you mean columns in a datagrid, you should explore the possibilities of the TableStyle.
My advice is free, and you may get what you paid for.
|
|
|
|
|
|
I am not very clear about what do u want to know, i will tel u what i got out of your question
1 U want to have a right click event.. If so then every object has a right click event handler associated you can go to the codes and select the object and then right click the event handler will come
2 U want to have a menu coming on right click of an object then use ContextMenuStrip
Hope this helps u
Good luck
|
|
|
|