|
Check this link out:
http://RustemSoft.com/DataGridColumns.htm
They have a pretty good one with examples.
|
|
|
|
|
thank you for the link, im going to look into it
|
|
|
|
|
i've got a form with 3 fields: comboBox, button(text = &Add) and a textBox.
Run the form, type, "abc" in the comboBox, highlight the "abc", click on the Add button and the eventcode shows a selectionlength of 0.
TextBox1.Text = cboBox.SelectionLength
go through the same process and type Alt A, instead of clicking the Add button, and the eventcode shows a selectionlength of 3.
the parameters for the 3 fields are default, visual basic.net, running in MDE 2003, version 7.1.3088.
i've also tried the other selection options, eg, selectedindex, and still get unexpected results.
thanks.
|
|
|
|
|
mattlove wrote: Run the form, type, "abc" in the comboBox, highlight the "abc", click on the Add button and the eventcode shows a selectionlength of 0.
TextBox1.Text = cboBox.SelectionLength
go through the same process and type Alt A, instead of clicking the Add button, and the eventcode shows a selectionlength of 3.
The reason for this is that when you click on the button, focus leaves the combobox, and nothing is selected anymore. Thus the "0". When you do an "Alt A", focus is still in the combobox, and you have three characters highlighted, you get a "3".
mattlove wrote: i've also tried the other selection options, eg, selectedindex, and still get unexpected results.
You don't say anything about adding items to the combobox items, so I am assuming that it is empty. Thus, regardless of clicking the button, or doing an "Alt A", you will probably get a "-1".
I guess my question would be: What do you want to happen?
Let's assume that you want the Add button to add the item to the combobox list. In the button click event, use this code:
CboBox.Items.Add(CboBox.Text)<br />
TextBox1.Text = CboBox.Items.Count
This will add what is typed in the combobox to the combobox list, and then put the number of items in the list into the textbox.
Hope this helps.
Roy.
-- modified at 12:28 Thursday 8th December, 2005
|
|
|
|
|
thanks roy.
my example should have been based on the delete function in which the difficulty is more acute than the add function...my fault.
what i want to do is highlight something in the comboBox and delete it using the delete button.
your answer helped me solve it but i have a question.
my solution is to use selectedindex which returns -1 if nothing is selected...working like a charm.
so, the reason selectedtext, selectedvalue, selectionlength and selectionstart don't work is because the field is out of focus, is that right? can you or do you want to recommend any other solutions i could use?
thank you very much in any case.
matt
|
|
|
|
|
You could try putting this in your Delete button handler:
If cboBox.SelectedIndex > -1 Then<br />
cboBox.Items.Remove(cboBox.SelectedItem)<br />
End If
This does not care if the item has focus or not.
Roy.
|
|
|
|
|
works like a charm
thanks again roy.
matt
|
|
|
|
|
How to set the text of a text box on a crystal report at run time?
Dim strEmpName As String
strEmpName = TextBox1.Text
Dim a As Form2
a = New Form2
Dim crReport As CrystalReport1
crReport = New CrystalReport1
Dim cr As CRAXDDRT20.TextObject
cr = crReport.Section1().ReportObjects.Item("Text3")
cr.SetText(strEmpName)
a.CrystalReportViewer1.ReportSource = crReport
a.Show()
Farah
|
|
|
|
|
this might help u....
add a parameter field in ur report.
than use the following code:-
Dim rpt As New myreport ''the report that u created
CrystalReportViewer1.ReportSource = rpt
rpt.SetParameterValue(0, textbox1.text.trim)
this should work it worked with mine..
abhinav
|
|
|
|
|
How to set the text of a text box on a crystal report at run time?
Dim strEmpName As String
strEmpName = TextBox1.Text
Dim a As Form2
a = New Form2
Dim crReport As CrystalReport1
crReport = New CrystalReport1
Dim cr As CRAXDDRT20.TextObject
cr = crReport.Section1().ReportObjects.Item("Text3")
cr.SetText(strEmpName)
a.CrystalReportViewer1.ReportSource = crReport
a.Show()
Farah
|
|
|
|
|
I need to create a empty sound wave file. I do it like this now.
System.IO.File.Create("test.wav")
This test file has zero bytes.
But the program I am using can't record to it. Says somthing like file type not recognized.
However if I use explorer and right click new - new wave sound, The program can record to it ok.
This one created by explorer has 1k bytes.
How can I programicly create a "formated?" wave file like explorer?
-- modified at 11:40 Tuesday 6th December, 2005
|
|
|
|
|
|
I would create a wav file in explorer and figure out what data is in it (by reading it into an array, for example). Then whenever you want to create a wav file, you just have to write out those bytes. You will probably want to bury the header bytes for a "blank" wav file as a resource in your application so you dont have to worry about keeping an empty file around that could get accidentally deleted.
|
|
|
|
|
Hey everyone, my name is Vik. I'm foreign young school student n i jus started learnin programing. I got 5 pictures to load in a picture box, "next" and "previous" button. Got no idea how i can implement it, can someone please give me a bit of help.
in old VB i could write path for a fil in this form "me:\pic\example.gif", it doesnt seem to work in VB.Net,can anyone tell me what is a way for doin this?
Thank u,
Vik
|
|
|
|
|
picturebox.Image = System.Drawing.Image.FromFile("C:\path\as\string.here")
Geronimo
|
|
|
|
|
Hi!
I have a created a windows service. Now I'm writing an application that monitors this service. I want the application to display a NotifyIcon in the system tray. Also I want the service to start the monitoring application if it's not already running.
If I start the application on it's own everything works fine. I can see and intercat with my icon, but if the service starts the application I can see the process running in the Task Manager but the system tray icon is missing.
Any ideas?
|
|
|
|
|
It's missing because the service started the monitoring application on the wrong desktop. Service run under their own desktop, not the one you see when you log in.
You might want to try going into the Service manager, getting properties on your service, click the LogOn tab, and check the box that says something like "Allow service to interact with desktop".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yes, I guessed that it was something like that.
When the service is starting the monitoring application they both run as SYSTEM in the task manager. I've tried to set it to allow interaction with my desktop, as you proposed, with no result.
I also tried to allow the service to run as my user account. Now both the service and the monitoring application is running as my local user in the task manager but still no system tray icon?
|
|
|
|
|
I was afraid of that...
The easier method is to not create the monitor process from the service. This is because the service will run without a user being logged in, and hence, there's no desktop to start the process on anyway.
You can use .NET Remoting to get status information from your service. Start the manager application out of the Run key in the Registry. This will start the monitor whenever a user logs in. This monitor can then contact the service over Remoting and get status information and updates through events over Remoting. Then the monitor can put up the icon in the Tray without any desktop problems.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
HI Gurus. I am trying to generate a Table with dynamic controls in different
cells. I am at the same time generating Validation controls and assigning
"control to validate" property to the ID of the generated controls. The
generation works as expected, however when I press the submit button,
validation controls do not react. I posted the code below for the entire
table. In the last line I add the table to a session and regenerate the table
in the Page_Init between postbacks. Can anyone suggest why the validation
does not fire? BTW the "Causesvalidation" property of the submit button is
"ON". In advance, many thanks.
For counter = 0 To CInt(qty - 1)
tRow = New HtmlTableRow
tRow.ID = "fltRow" & counter
'mile cells
tCell = New HtmlTableCell
tCell.ID = "cellMile" & counter
tCell.Width = "20px"
txbMile = New TextBox
txbMile.ID = "txbMile" & counter
validator = New RangeValidator
validator.ControlToValidate = "txbMile" & counter
validator.Type = ValidationDataType.Integer
validator.MinimumValue = txbStartMile.Text
validator.MaximumValue = txbEndMile.Text
validator.Text = "*"
validator.ErrorMessage = "The value must be between " &
txbStartMile.Text & " and " & txbEndMile.Text
txbMile.Width = New System.Web.UI.WebControls.Unit(30)
tCell.Controls.Add(txbMile)
tCell.Controls.Add(validator)
tRow.Cells.Add(tCell)
'chain Cells
tCell = New HtmlTableCell
tCell.ID = "cellChan" & counter
tCell.Width = "20px"
txbchain = New TextBox
validator = New RangeValidator
validator.Type = ValidationDataType.Integer
validator.ControlToValidate = "cellChan" & counter
validator.MinimumValue = txbStartYards.Text
validator.MaximumValue = txbEndYards.Text
validator.Text = "*"
validator.ErrorMessage = "The value must be between " &
txbStartYards.Text & " and " & txbEndYards.Text
txbchain.Width = New System.Web.UI.WebControls.Unit(30)
txbchain.ID = "txbChain" & counter
tCell.Controls.Add(txbchain)
tRow.Cells.Add(tCell)
'fault Cells
tCell = New HtmlTableCell
tCell.ID = "cellFault" & counter
tCell.Width = "80%"
' validator = New RangeValidator
txbFault = New TextBox
txbFault.ID = "txbFault" & counter
recValidator = New RequiredFieldValidator
recValidator.ControlToValidate = "txbFault" & counter
recValidator.Text = "*"
recValidator.ErrorMessage = "Please add the fault"
txbFault.Wrap = True
txbFault.TextMode = TextBoxMode.MultiLine
txbFault.Width = New System.Web.UI.WebControls.Unit(400)
tCell.Controls.Add(txbFault)
tRow.Cells.Add(tCell)
'add created row to the table
tableFaults.Rows.Add(tRow)
Next
tableFaults.Width = "100%"
tableFaults.Border = "1"
tableFaults.ID = "tblFaults"
pnlFaults.Controls.Add(tableFaults)
Session("tableFaults") = tableFaults
Phillie
|
|
|
|
|
Hi all,
How to determine the line number and the column number of Notepad acoording to the posion of the cursor/caret.
Thanks And regards
Samik Karmakar
Samik
|
|
|
|
|
Hi all,
How to determine the line number and the column number of Notepad acoording to the posion of the cursor/caret.
Thanks And regards
Samik Karmakar
Samik
|
|
|
|
|
Basically, you can't. Notepad doesn't expose any such API.
In theory, you could probably calculate it, but you would have to get the text from the textbox in Notepad, get the font that it's using, get the window dimensions, and get the status of the Word Wrap option. Not at all easy from your application, since Notepad doesn't support plug-in's.
Then you'll have to calculate the length of a line, using the Word Wrap status, window dimensions, font size, ..., yada, yada, yada, ...
It would be easier if you just wrote your own Notepad! Start with a TextBox on a form...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi guys.
need some help
i have created a window service with connects to sql 2000 as insert some records after every 30 min. the service is working fine but the problem is that it is consuming a lot of memory. can any one tell me how to reduce that consumption of memory. i m thinking to change the process priority will it help
or there is some other solution.
bi
abhinav
|
|
|
|
|
If your looking in TaskManager, then your looking in the wrong place to see how much memory your app is actually using. What your seeing in the memory RESERVED for the .NET runtime, or virtual machine, that your app is running inside of. This, by no means, is an indicator of your app keeping a stranglehold on that memory. The .NET Memory Manager will release any memory back to the system that Windows needs for other things.
And, no, changing the process priority will have no effect at all on that processes memory consumption.
Basically, there's nothing to do to get the memory footprint down. Just let the Memory Manager do it's job.
Now, that, of course, assumes that your code is written properly. If your allocating huge numbers of objects or keeping large numbers of records in datasets, unnecessarily, then you need to rewrite parts of your app to reduce it's memory consumption. But only you will know if that's even possible.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|