|
If the ComboBox is bound to a DataSource and the Combo's ValueMember and DisplayMember properties are set, SelectedValue returns the value of the item's ValueMember property.
If the Combo isn't bound to a datasource, then SelectedValue returns a string by calling the ToString method of the item that was selected.
To check to see if SelectedValue is Nothing:
If Not myCombo.SelectedValue Is Nothing
There are also the SelectedIndex and SelectedItem properties that could tell you which item was selected.
|
|
|
|
|
Not sure if this is the right forum for this, but I'm having an issue updating an old VBA macro that runs in an IBM Reflections Application. I want to be able to control the exiting/closing of the application. I need to be able to enter some code to log a user off their ID before the Reflections window closes or else it will cause problems when they log back in. Is that possible with a macro?
|
|
|
|
|
You'd probably be better off looking for a forum dedicated to Reflections. It's very unlikely anyone who has used it is going to see your post. I've got no experience with it myself, so I won't be much help at all.
|
|
|
|
|
any help, how can i adjust or change the ruler measurement in crystal report??
thank you...
jyn
|
|
|
|
|
Hi Members,
I have done a product in VB6.0. Consider the product can be a educational software. Iam releasing my product in USB drive like(CD) for all the schools.
I want to protect my product to run, even if they copy from the USB to any other devices like(CD, USB, etc)..
Can somebody help me to avoid this kind of sitution.
Thanks & Regards
Kumaran
|
|
|
|
|
I am not sure what you mean, you want to stop it running anywhere apart from the schools where it is installed, if so I think this is going to be hard, unless you put like a hidden authorisation file on each computer it is used on?
|
|
|
|
|
exactly the same. can you give me some suggestion.
Thanks & Regards
Kumaran
|
|
|
|
|
something simple like:
when your installing your app, have the setup program run your exe with a command line that is only known by you(not documented). this would install some key in either the registery or hidden file. when your app has this commandline it immediately shuts down after installing the key. then when somone executes your app, it should check if this key is present. if not, then say it's an invalid license.
|
|
|
|
|
Have a look at our product "Diamond Licensing". The product page is here[^].
You could use the RegistryStore to keep license data on each machine.
|
|
|
|
|
I am trying to do this loop, so it checks if a value entered is present, if not, it deletes the row, however, the process hangs once it finishes, how do i end the statement (i.e. when all records have been checked, display a message box), as I am not sure where to end it (I thought the end if and wend would end the statement, but do I possibly need an else somewhere?), cheers
p.s. this is VBA in excel 2003, but I assume its the same principal as VB
----
'When a cell contains data, perform the IF...
While Len(Range("B" & CStr(LFindRow)).Value) > 0
'If the cell does not contain the inputted criteria then delete the row
If Range("B" & CStr(LFindRow)).Value <> CustVar Then
Rows(CStr(LFindRow)).Delete
'End the IF
End If
'End/Loop the while
Wend
----
|
|
|
|
|
Hi,
there is a flaw in the logic: when Len is > 0 and the IF fails, the while will loop forever.
You should consider a while without if, i.e. AND together the two conditions in the WHILE.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I think your problem is that if there is data in the cell but it doesn't match the value you don't go to the next row.
try increasing LFindRow
good luck
|
|
|
|
|
Hi,
I am making an application which had a panel with multiple controls on it. Yet, when I change the resolution of the PC, the layout gets mixed up. Is there any way of easily compensating for this instead of individually adjusting the control sizes, as that is a very tedious task given that I have many controls on the panel.
Thanks in advance,
Ahmad
|
|
|
|
|
Cant you just lock the objects, which would stop them moving (I remember reading something about this??
Also, is it are you going up or down res, or both?
|
|
|
|
|
hi
i have searched everyware i didnt find any help to solve my problem
i want to work with group policy through vb.net
i have 250 computers in our network
our network administrator want an application utility for one click we can manage security
in group policy
Now they have to go to each computer and change permissions in local group policy one by one
about 100 of our computers are not on LAN because of security reasons
i didnt find any article on coding group policy
thanks
khurram saddique
khurram saddique
|
|
|
|
|
There really isn't much of anything in the way of documentation on this. Group Policy is nothing but a set of registry "tweaks" and security configurations encapsulated in a package. Usually, the packages are stored in the domain and distributed to the machine where they are applied by the Policy Manager.
The reason you're not finding anby information on this is because noone ever writes their own applications to manage policy. It's handled by the stuff built-in to Windows. There is very little documentation on it, but it does exist.
If you have the MSDN documentation installed in Visual Studio, hit F1. Make sure the Filter is set to Platform SDK, then type "Group Policy" into the "Look for" box and you'll find what little documentation there is on the architecure, the function reference, structures, interfaces, WMI classes and File Formats. Don't worry about looking for code examples, there are none.
|
|
|
|
|
How can I display a Crystal Report in VB.Net 2005. I have added a report by clicking on the Add\New Item\Crystall Report on the Solution Explorer window. And I have also desined the report and the data is getting fetched in the design mode.
Also how can I change the connection string property during runtime ?
Please Help, I am new to Crystall Reports.
Thanks in advance.
Sekhar
|
|
|
|
|
Hi,
On your Win Form add crystalreportviewer and reportdocument from the Toolbox.
and in code just add following 2 lines :
reportdocument.SetDataSource(dataset1.Tables(0))
crystalreportviewer.ReportSource = reportdocument
where your dataset contains the report data to be displyed.
Regards,
Ujjaval Modi
|
|
|
|
|
There is no Report Document in the ToolBox. Please can u tell me how to add Report Document in the ToolBox....
|
|
|
|
|
I assume you've got an db-view connected to the report. Normaly you don't have to provide the connection string anymore (it's hardwired into the generated report-class), if not you can allways use the DataSource-property of the report.
To show the report you need the CrystalReportViewer-Control (well it should be named something like this). Just put it on a form and set the ReportSource - property of the control to an instance of your report-class (same name as your report - get's generated - sometimes CR has problems with namespaces so look into the object browser) - that's it.
If you just want to print the report you can use the print-functions of the report without the viewer (same for exports - great for PDFs and so on).
Bye the way: I normaly use CR with datasets (so I greate an dataadapter for the dataview I like to see, create the CR with this dataset and then do something like:
<br />
dim report as new CrystalReport1<br />
report.SetDataSource(ctype(dataadapter.GetData(),DataTable))<br />
crviewer1.ReportSource = report<br />
This way I can pass parameters for the view in GetData (if I have any) - filtering in CR tended to be done on the client (i.e. all the data of the table/view was passed to the report and THEN filtered - don't know if this is still the case but I use the above approach anyway ... )
|
|
|
|
|
I could not find my previous message. So I posted it again with update from Dave Kreskowiak.
Dave: Thanks for your information. I tried your suggestion. However, I could not call Paint Event in sequence. Could you check my simplified code below? Thank you.
Public Class Form1
Dim gl As Integer = 0
Private Sub measure()
Dim i As Integer
For i = 0 To 16
gl = i * gl
If gl = 256 Then
gl = 255
End If
Panel1.Invalidate()
System.Threading.Thread.Sleep(200)
Next
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Panel1.Invalidate()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
measure()
End Sub
Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
Panel1.BackColor = Color.FromArgb(gl, gl, gl)
End Sub
End Class
------------------------------Replay from Dave Kreskowiak on 12/2/07 --------------------------------
You cannot put this loop and sleep code in the paint event. Think of the Paint event like a moment in time. It's used to paint a single frame of an animation.
Move the loop and sleep code outside the Paint event and keep track of what the Paint event needs to draw what you want outside the event code. Inside your loop, you update the variables holding the data the paint event needs, call Invalidate on your panel control, then Sleep.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
------------------------------ Original message-----------------------------------------------------
I used e.Graphics.Clear in Panel.Paint to change gray level of the Panel. Thread.Sleep() was added to set a time delay between pattern update and measurement. However, this delay function did not work as I expected. Image pattern would be updated after Thread.Sleep(), and take measurement right away. I wonder how you add delay function in VB.NET. Please advise this question. Thank you.
Steven
Public Sub PanelPG_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PanelPG.Paint
for i = 0 to 16
gl = i * 16
e.Graphics.Clear(Color.FromArgb(gl, gl, gl))
System.Threading.Thread.Sleep(200)
objCa.Measure()
Next i
SaveData()
End Sub
|
|
|
|
|
Well I'm not sure if the code will work this way (you will block your GUI-thread with the Sleep) but I won't sugguest doing it this way.
Why don't you use a timer?
By the way: you are handling the Paint-event and in there you are setting the BackColor, normaly you will want to do the actual drawing inside the Paint event!
Try using a timer that is called every 200ms that will update the BackColor of your panel that should do the work.
(By the way: if you need a lot of these things inside your app you might consider moving to WPF - you will get all this for free without doing the coding by yourself )
|
|
|
|
|
I implemented Timer, but measure() is still called right after Paint Event. Does this mean I need to apply multithreading to make sure Paint Event finishing image update? Is there any tip about how I can apply multithreading in my code?
Thanks.
|
|
|
|
|
No, multithreading will not solve this and will actually make it far more difficult to fix.
Measure is being called when that line executes, in the order it's shown, not after the method it's in finishes.
The reason the code doesn't paint is because immediately after you call Invalidate, you put the UI thread to sleep, and all the drawing with it! Your code never gives the forms message pump time to execute to see the Paint message it's giving and let the Paint event code execute. This is going to be a hacked up way of doing this (with side effects you didn't count on,) but, replace the Thread.Sleep line with Application.DoEvents() .
DoEvents releases control to the applications message pump so it can process and dispatch all the pending window messages that have been queing up while your code has been executing, including WM_PAINT messages.
|
|
|
|
|
Thanks for replay.
However, I tried Application.DoEvents(), but I need some function like Thread.Sleep to add delay between Paint Event and Measure(). Otherwise, I still have Measure() happened too fast before Paint Event finished displaying image. Please advise. Thank you.
PanelPG.Invalidate()
t1 = VB.Timer
Do While VB.Timer < t1 + 1
Application.DoEvents()
Loop
Measure ()
|
|
|
|