|
I am kinda new to vb.net so please advice me
I am writing an app at which i want to organize my controls in to namespaces
So i write a user contrl class and i placed it in a folder called plugin
When i warp with NameSpace xxx.Plugin and End NameSpace and i switch to desinger view i get this error:
The class Clock can be designed, but is not the first class in the file. Visual Studio requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try loading the designer again.
Please help?
|
|
|
|
|
2hdass wrote: so please advice me
Sure. Firstly, please delete your duplicate post.
I suspect your issue is that the IDE generates two code files ( and I thought generated namespaces based on folders ), so you probably need to change/create the namespace in both files. This is assuming this is a winforms app.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello,
VS 2005 using typed datasets
My customer want to close a form, but before the form closes, they want to be informed of any unsaved changes.
I have list box that is bound to a bindingsource that dislays orders. I also have a bindingsource that is bound to a datagridView. I want to detect changes in these 2 data tables.
I have decided to use MyDataSet.HasChanges(). However, as I have been testing this, i find that it always produces a true, even when I have saved all my data to these 2 tables.
<br />
hasChanges = Me.DsAddComponetAndEquipment.HasChanges()<br />
If (hasChanges) Then<br />
'Inform the user of unsaved data<br />
Else<br />
'Everthing is saved so close form<br />
End If<br />
However, if i do the following:
<br />
MydataSet.AcceptChanges()<br />
MyDataSet.HasChanges()<br />
Then it will be false.
In my typed dataset I have all the data tables for my project, about 30. So maybe it is detecting one of them as been changed. However, even when I don't open this forms that use the other data tables, i still get a true everytime I call the HasChanges. I just want to check only the orders and orderDetails table for changes.
Is there another method for doing this.
As an alternative I tried the get changes for the 2 data tables, if they return nothing, then there are no changes
<br />
dtOrders = Me.MyDataSet.Orders.GetChanges()<br />
dtOrderDetails = Me.MyDataSet.OrderDetails.GetChanges()<br />
However, the above code resulted in an error "OrderDetailsID doesn't allow NULLs" This was because I added a datarow to the datatable (orderDetails) then called the getChanges. Not sure how to solve the above error.
Many thanks,
|
|
|
|
|
Hello,
The following code work well
Dim ds As New DataSet<br />
<br />
<br />
Private Sub frmTry_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
SqlDataAdapter1.Fill(ds)<br />
dgv.DataSource = ds.Tables(0)<br />
End Sub<br />
<br />
<br />
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click<br />
SqlDataAdapter1.Update(ds) 'Save data to database<br />
End Sub<br />
<br />
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click<br />
If ds.HasChanges Then<br />
MessageBox.Show("Database has been changed")<br />
Else<br />
Me.Close(); 'Database has not been changed<br />
End If<br />
End Sub
|
|
|
|
|
I am able to stop and start the timer on my program when I click something. But when I try to stop and start a timer in a method that runs when a file is updated, it would stop the timer. WHY?:
Private Sub OnChanged(ByVal source As Object, ByVal e As FileSystemEventArgs)
Me.updateTimer.Stop()
frm.OpenFile(OpenCertainFile)
Do While Not EOF(1)
Input(1, Str.Ticket)
Input(1, Str.Hauler)
Input(1, Str.Truck)
Input(1, Str.Material)
Input(1, Str.DateIn)
Input(1, Str.DateOut)
Input(1, Str.WeighIn)
Input(1, Str.WeighOut)
Input(1, Str.NetWeigh)
Input(1, Str.Loader)
If Str.Ticket = newDataGrid.Item(newDataGrid.CurrentRowIndex, count).ToString Then
MessageBox.Show("Same")
Else
MessageBox.Show("Not same")
End If
count = count + 1
Loop
FileClose(1)
Me.updateTimer.Start()
|
|
|
|
|
Hi Cory,
Maybe I misunderstand your question, or I may just say something stupid, but the first thing that I see happening in this piece of code, is that you are stopping the timer yourself, and then start it again after the update has taken place. Shouldn't that be the other way around?
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Yes, I am opening a file and don't want the my updateList method to run because it opens a file too and I get a error stating it is already open. So, I was able to stop the timer in the Edit_click method but not the onchanged method. WHy? Any ideas?
|
|
|
|
|
Hi Cory,
I am sorry, but as I don't know your app, I don't understand what you mean.
The only thing I can think of that you could try is to add a second timer.
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Can anyone help me with this?
I am able to stop and start the timer on my program when I click something. But when I try to stop and start a timer in a method that runs when a file is updated, it would stop the timer. WHY?:
Private Sub OnChanged(ByVal source As Object, ByVal e As FileSystemEventArgs)<br />
Me.updateTimer.Stop()<br />
frm.OpenFile(OpenCertainFile)<br />
Do While Not EOF(1) <br />
<br />
Input(1, Str.Ticket)<br />
Input(1, Str.Hauler)<br />
Input(1, Str.Truck)<br />
Input(1, Str.Material)<br />
Input(1, Str.DateIn)<br />
Input(1, Str.DateOut)<br />
Input(1, Str.WeighIn)<br />
Input(1, Str.WeighOut)<br />
Input(1, Str.NetWeigh)<br />
Input(1, Str.Loader)<br />
<br />
<br />
If Str.Ticket = newDataGrid.Item(newDataGrid.CurrentRowIndex, count).ToString Then<br />
MessageBox.Show("Same")<br />
Else<br />
MessageBox.Show("Not same")<br />
End If<br />
count = count + 1<br />
Loop<br />
<br />
FileClose(1)<br />
<br />
<br />
<br />
Me.updateTimer.Start()
|
|
|
|
|
i am not too familiar with events in .net
I am wishing make my program fire an event when a variable changes, how can I do that?
thx
|
|
|
|
|
2hdass wrote: I am wishing make my program fire an event when a variable changes, how can I do that?
You can't.
If the variable is a field on the class then you should encapsulate it in a property and have the property's setter fire the event.
This article[^] shows how to use events (See the sibling to sibling section). The event is fired from a method, but a property is just syntactic sugar for a get or set method anyway.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
Thx
The app I am writing actually wants to read the System's Power State using P/Invoke to the Win32 API on my WM5.0 PDA. I am wondering if there is a predefined event already included in the library/
|
|
|
|
|
could u please tell me a way to send data from a listbox to textbox vb.net 2005
|
|
|
|
|
sixecho wrote: could u please tell me a way to send data from a listbox to textbox vb.net 2005
What data do you want to send from the list box?
Let's assume you mean that you want the text box to display the currently selected item in the list box.
MyTextBox.Text = MyListBox.SelectedItem.ToString();
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
this code was helpful but what i really wanted was to get all the items in the list box at once to the text box...(without selecting any item)...
|
|
|
|
|
Then iterate over the items collection.
For Each Object item In MyListBox.Items<br />
...
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
I need a button that when the user runs the mouse over the button (not click) the color of the button's border changes (showing the user that the mouse is in the button's active area). I cannot find anyway to change the color so any hints would be very helpful.
Thanks!
Natalie
|
|
|
|
|
DotNet Button Control is exactly what you are talking about.whats the problem with that?
A.E.K
|
|
|
|
|
A.E.K wrote: DotNet Button Control is exactly what you are talking about.whats the problem with that?
How do I change the color of the border (from black to something else)?
|
|
|
|
|
hie guys,
i am developing a call logging system using VB.Net and SQL 2005 . How do i calculate the downtime of a job (i.e. the difference between the time call is logged and when call is closed) excluding weekends and non-working-hours.
thanks, i am stack........
|
|
|
|
|
i think you must log the downtime call to your database and when the call is closed. then get the difference of the two.
Don't block the drive way of all the newbies in programming.
|
|
|
|
|
klaydze wrote: i think you must log the downtime call to your database and when the call is closed. then get the difference of the two.
Don't block the drive way of all the newbies in programming
yep, thats pretty straight klaydze; maybe i did not point out clear that i need to EXCLUDE weekends and non-working-times(i.e. time b4 8am and time after 5pm).
e.g. if a call is logged on Friday 8am and closed the following Monday 17pm, for a business thats runs 9 hours a day; the downtime should be 18hrs NOT all inclusive hours from Friday 8am to Monday 5pm.
thanks,
|
|
|
|
|
I have build an application where I create an extension "alm". Now I want to register this extension so that on double click of any file with "alm" Extension should run my application.
Regards
|
|
|
|
|
The easiest way is interactively:
double-click a file with that extension in Windows Explorer
when it shows its dialog telling "Windows can not open..." choose "select from list",
then "Browse", browse to your exe file, check the checkbox "Always use..." and
click "OK". This will create a permanent link and register it.
You can do that programmatically also, I don't know the details be heart.
|
|
|
|