|
I don't know if it can count as a solution.
What you can do for textbox, richtextbox, checkbox is handle an event like Keydown, checkchanged, selectedindexchanged
In this example (sorry, in c#) i enable the savebutton when i modify a control. For you, see below the example.
private void CreateEventHandlers()
{
tbxC1.KeyDown += new KeyEventHandler(EnableSave);
tbxC2.KeyDown += new KeyEventHandler(EnableSave);
cmbxT1.SelectedIndexChanged += delegate { EnableSave(); };
tbxC3.KeyDown += new KeyEventHandler(EnableSave);
tbxC4.KeyDown += new KeyEventHandler(EnableSave);
}
private void EnableSave()
{
if (!m_bUpdating)
cobject.saveObject.Enabled = true;
}
private void EnableSave(object sender, KeyEventArgs e)
{
if (m_bUpdating)
return;
if (e.KeyCode == Keys.F1)
return;
else if (e.Control && e.KeyCode == Keys.C)
return;
else if (e.Control && e.KeyCode == Keys.V)
computerObjectFilter1.saveObject.Enabled = true;
else if (e.Control)
return;
else if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down || e.KeyCode == Keys.Left || e.KeyCode == Keys.Right || e.KeyCode == Keys.End || e.KeyCode == Keys.Home || e.KeyCode == Keys.PageUp || e.KeyCode == Keys.PageDown || e.KeyCode == Keys.Next || e.KeyCode == Keys.Insert)
return;
else
cobject.saveObject.Enabled = true;
}
For you, change the content of enable save to:
Console.WriteLine(sender.ToString)
Console.WriteLine(CType(sender, Button).Name.ToString())
The result will be something like:
System.Windows.Forms.Button, Text: &OK
btnOK
So you can make for every type of control a sort of enable save so you can cast them into the control so you can access all that you want, or you do the following:
1. Test Console.WriteLine(sender.ToString) with Instr() if it contains a Button, TextBox, ...
2. Than Cast correct resulting the test
You also asked Label, well, at the moment i don't have a solution for it. But if the one above is satisfying, you are a step ahead...
lmk
|
|
|
|
|
Thanks For the response ,
But i got it another way .
DVSRIRAM
|
|
|
|
|
Nice,
Can you share your solution? That is what this site is all about.
|
|
|
|
|
Firstly, an apology. My question isn't directly related to VB .NET but actually VBA in Office 2003. However, i have read these forums many times regarding VB .NET and C# questions and always have found responces friendly and informative. Hopefully the same can come from this question.
Simply, i have stored within an Access database OLE objects which are google maps of areas of the country. What i need to do is import this data into a word template. I know there are methods of using the Win32 API to store the data in memory and read directly to that from word, but i have no idea as to how this would be accomplished. What i was hoping for was a method similar to passing the data as a bookmark to word, but as bookmarks only accept Strings, i'm stuck for a way for this to work.
I have also been looking into another method of storing in the database the file path to the images, passing this path to word, then getting this path into the LoadPicture() method for the image. But after passing the path through as an bookmark, focus is lost on the bookmark which stores the path and i cannot reference it anymore.
Any advice you could offer to solve this problem would be very much appreciated. Although i do ask you that no messages contain the sentence "Stop using VBA!!!".... because i've been telling myself that enough already!
Many Thanks,
Plation
|
|
|
|
|
If no one can answer this question, would anyone be tempted in starting a project with me to figure out how to do this? When we find the answer we can post an article on codeproject about it.
Tempted? I'm sure im not the only person in the world who has wanted to do this.
|
|
|
|
|
Hi guys,
I am struggling to change the font style of a selected node in a treeview and a selected item in a listview control, your help is very much appreciated.
Regards
|
|
|
|
|
Got it and a bit embarrassed, its amazingly simple.
here are my lines, I used the AfterSelect event of the TreeView to set the font of the node, its parent and all its ancestors to bold, when another node is selected, i set the new node and its ancestors to bold, while returning the previously selected node to the normal font of the TreeView . By removing the while... statement in both methods, only the selected node is set to bold and back to normal. I know there are most likely better solutions but this one works fine.
<code>Dim previousSelectedNode as TreeNode
...
...
Private Sub Treeview1_AfterSelect(ByVal sender As System.Object, ByVal e As _ System.Windows.Forms.TreeViewEventArgs) Handles Treeview1.AfterSelect
Dim xnode As TreeNode
If previousSelectedNode IsNot Nothing Then DeSelectNode()
e.Node.NodeFont = New Font(Treeview1.Font, FontStyle.Bold)
xnode = e.Node
While xnode.Parent IsNot Nothing
xnode = xnode.Parent
xnode.NodeFont = New Font(Treeview1.Font, FontStyle.Bold)
End While
previousSelectedNode = e.Node
End Sub
'Deselecting a node
Private Sub DeSelectNode()
previousSelectedNode.NodeFont = Treeview1.Font
While previousSelectedNode.Parent IsNot Nothing
previousSelectedNode = previousSelectedNode.Parent
previousSelectedNode.NodeFont = Treeview1.Font
End While
End Sub
|
|
|
|
|
Hi i have a form with a datagridview and a listbox. The datagridview is bound to a table with 2 columns. the first column is a column that needs to store the name of a genre(specified in the listbox). the second column(which I have made invisible) is merely the name of the 24 hour template. what I mean by this is that the point of the datagrid is to allow a user to drag and drop genres to each hour of a day(so they need to drag 24 genres) onto the datagrid) and then save this as a 24 hour template. the datagrid is thus bound to the child table of a table called "24HourTemplate". when the user click save it will prompt for a name for the template and record the chnages to the 2 tables. how do I perform a drag and drop. I have enabled it for the tables but nothing happens?
Mr Oizo
|
|
|
|
|
Hi I am writing music and advert scheduling placement program for a radio station.I am nearing the final stages but need something that will allow the user to view the schedule and drag and drop songs/adverts into slots on the shedule. the problem is that everything is scheduled around time and constraints around that time(eg: a certain genre of music plays at a certain time of day). Basically I need something that displays the time in hours, minutes and seconds and can allow the user to drag and drop information into slots coinciding with specific times? Is there anything like this out there for free? Any advice on how I could make something like that? I was thinking of using a datgridview and then creating a schedule table which would just hold all the information the schedule needs and binding the 2 together?
Mr Oizo
|
|
|
|
|
Please don't double post. People here are volunteers and will answer your question when they are able, if they can provide an answer. Posting it a second time an hour later is a sure way to not get a response to either.
|
|
|
|
|
Hi my project im doing does music and advertisement placement on a schedule for playing on a radio station. It uses various selection criteria to schedule the playlist. I am nearing the final stages but am wondering if anyone could give me any advice how I should store the final playlist and what to use to display the completed schedule to the scheduler? at the moment I am thinking of using a datagridview. the problem is that everything is scheduled around the hours in the day and what types of music(specified by genre) and adverts need to play at certain times. I basically just need some type of tool or something that shows the hours, minutes and seconds in a 24 hour clock and allows me to drag and drop information coinciding with a specific time. Any ideas will be really appreciated. thanks
Mr Oizo
|
|
|
|
|
I have a strange problem
set up:
I have a mdi parent with server mdichildren (shown as tabs)
an mdichild has a control on it (datawindow) wich contains serveral fields
now when I create a new record for the first time the focus is set correctly on the correct field en the user can imidattly start entering data. But if we create another new record the focus is not set correctly. The code behinde the first and second new record is identicly (since it's the same code)
when I ask my form wich control has the focus it tells me that the correct control has the focus (datawindow) but still I can not enter any data without clicking in the control first. Even tab doesn't work, neighter do my schortcuts (who are at form level).
If I use alt-tab (to swith between open windows) and return to the programme (with alt-tab) the foces all of the sudden is set correctly.
I'v stept thru my code and nothing happens after I set the focus (it's the last thing I do)
On a side note:
the mdi child inherits from another form (but nothing happens there, at least not after I set the focus)
the same thing works on other forms just not on the last 5(or so) I created
Anyone have an idea what can cause this problem? Or how I can make sure the last thing the programme does is setting the focus?
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
i propose u change the tab-index for the form which doesnt focus correctly. Set the index to the desired order for data entry, then combine with the set focus code and should solve ur problem.
---------------------------
Baniani mbaya, kiatu chake dawa.
Regards,
Hesbon Ongira
Nairobi, Kenya.
|
|
|
|
|
tabindex is set correctly so that wasn't it
I solved it but still don't know why the problem occured in the first place
but apperently another control that I use was maintaining the focus nomatter what I did
so I just don't refresh it anymore (it's not needed anyway so)
thank you for you time
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
Hi friends..
I need to get all the .exe's running in a machine and display them in my application .How to do it..? In specific i need to get the .Net exe's alone..
Somebody help in this regard as early as possible..
Regards,
Balaguru
|
|
|
|
|
This is not exactly wat u want but i think it could be a starting point.
http://www.vbdotnetheaven.com/UploadFile/prvn_131971/machineprocessvb11182005001454AM/machineprocessvb.aspx
|
|
|
|
|
Hi Mbire..
Thx for the reply..But i need it specifically to .Net .exe's
Regards,
Balaguru
|
|
|
|
|
Public crxApp As CRAXDRT.Application
Public crxReport As CRAXDRT.Report
Public crxDataBase As CRAXDRT.Database
Public crxTable As CRAXDRT.DatabaseTable
Public crxTables As CRAXDRT.DatabaseTables
Public strSelectionfrm As String
Public strCRSourcePath As String
Private Sub frmCrystalReport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.MdiParent = frmMain
crxApp = New CRAXDRT.Application
crxReport = crxApp.OpenReport(strCRSourcePath, 0)
crxReport.RecordSelectionFormula = strSelectionfrm
crxDataBase = crxReport.Database
crxTables = crxDataBase.Tables
For Each crxTable In crxTables
crxTable.Location = DataSource
crxTable.SetLogOnInfo("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & reportPath, "myDatabase.mdb", "", "password")
Next crxTable
'Error occur here! i dont know why im access denied.. but if i will ommitt the .SetReportVariableValue() then it works just fine without committing access denied but then i have to set some variable i've declare inside the report..
crxReport.SetReportVariableValue("varEduc", "Hello Crystal World")
AxCRViewer1.ReportSource = crxReport
AxCRViewer1.ViewReport()
crxDataBase = Nothing
crxTable = Nothing
crxTables = Nothing
crxReport = Nothing
crxApp = Nothing
Catch ex As Exception
MsgBox(ex.ToString())
Finally
End Try
End Sub
***************
crxReport.SetReportVariableValue("varEduc", "Hello Crystal World")
the varEduc is already declare inside the report which means it is existing variable inside report..
is anybody there who have a good idea or solutions about this??? please???
Anybody there Please help me with this headache...
-- modified at 3:00 Wednesday 26th September, 2007
|
|
|
|
|
Hi all,
I want to connect to an Excel File in VB.NEt could anyone help me out
Thanks in Advance..
|
|
|
|
|
hi vidya
here's the code
Public Sub excelconn(ByVal exlpath As String)<br />
exconn = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; " & "data source='" & exlpath & "'; Extended Properties=Excel 8.0;")<br />
exconn.Open()<br />
Dim da As OleDbDataAdapter<br />
da = New OleDbDataAdapter("select * from [Sheet1$]", exconn)<br />
da.Fill(ds)<br />
End Sub
let me know if it works for you
help everyone
|
|
|
|
|
Thank u so much
Its working fine
|
|
|
|
|
All our winform apps are deployed using clickonce - works fine.
We have a central authentication and autorisation app and the logon DLL is deployed with each app.
We are building a single logon app to access all the apps.
I can locate the "application reference" in C:\Program Files\Group\......."
Using the App ref
Dim sApp As String = mvApp.Shortcut
System.Diagnostics.Process.Start(sApp)
I get the following error
System.ComponentModel.Win32Exception was unhandled
ErrorCode=-2147467259
Message="The system cannot find the file specified"
Source="System"
Does anyone have a suggestion how to launch a clickonce app from another VB App
|
|
|
|
|
The Application Reference resides under
C:\Documents and Settings\username\Start Menu\Programs\Group Risk
|
|
|
|
|
The appref has an extension that windows does not display (.appref-ms)- I had to use dos to get the extension - how quaint.
C:\Documents and Settings\username\Start Menu\Programs\Group Risk\StressMastr.appref-ms
System.Diagnostics.Process.Start(sApp) now launches the program successfully. Now to include a command line string!
|
|
|
|
|
Hi,
I have a project and I have designed the form, but I am not sure of my code. Can somebody help me plz?
This is the question of my project:
A local car rental company would like a computer application to calculate and display rental charges for each renter and summary rental charges for the day. The company charges AED60 per day plus AED0.8 for each kilometre driven by the renter. In this assignment, you are expected to use structured programming methodology to develop a user-friendly, high quality VB.NET windows system that will handle the following:
1. For each renter:
1.1the application must be enable the user to input the renter’s name, beginning odometer reading, ending odometer reading, and the number of days the car was used. The application will check to ensure that the name of the customer is not blank, ending odometer reading is greater than the beginning odometer reading, and that the beginning odometer reading and number of usage days are greater than zero – appropriate error messages must be displayed if incorrect data is entered by the user.
1.2when the compute and display button is clicked, the application upon ensuring that correct data has been entered, will calculate and display in appropriate controls, the charge for kilometres driven, the charge for the usage of the car, and the rental charge (sum of kilometre and usage charges). After displaying charge details for each renter, the system will update and display summary data (totals for kilometres, usage and rental charges).
2.Prepare for next renter’s charges or cancel the current renter by having a button for clearing all user entered data and computed details – but not the summary details. The summary details must always reflect the latest totals, and they are not to be cleared while the program is running.
|
|
|
|