Click here to Skip to main content
15,899,935 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: The holy comma operator Pin
Chris Losinger26-Nov-07 7:15
professionalChris Losinger26-Nov-07 7:15 
GeneralRe: The holy comma operator Pin
Michael Dunn27-Nov-07 16:47
sitebuilderMichael Dunn27-Nov-07 16:47 
GeneralRe: The holy comma operator Pin
Anthony Mushrow27-Nov-07 2:38
professionalAnthony Mushrow27-Nov-07 2:38 
GeneralRe: The holy comma operator Pin
Michael Davey 127-Nov-07 12:08
Michael Davey 127-Nov-07 12:08 
GeneralRe: The holy comma operator Pin
Mehmet Suyuti Dindar27-Nov-07 22:50
Mehmet Suyuti Dindar27-Nov-07 22:50 
GeneralRe: The holy comma operator Pin
f228-Nov-07 7:19
f228-Nov-07 7:19 
GeneralRe: The holy comma operator Pin
jschell11-Dec-07 10:03
jschell11-Dec-07 10:03 
GeneralGive me a gun pliz Pin
DoomedOne23-Nov-07 7:40
DoomedOne23-Nov-07 7:40 
Hi, I found this code in an old VB6 app that we need to "upgrade" (in fact replace with a new one be a much better approach, but...)

cbo_Caminos is a ComboBox, o_rs is defined as ADODB.Recordset

If CInt(Trim(Mid(cbo_Caminos.Text, 151, 6))) = CInt(o_Rs.Fields("NroCamino")) Then<br />
	....<br />
	'do something  <br />
End If<br />


And yes o_Rs.Fields("NroCamino") is an integer
Why not use ItemData of the combobox to store de integer value associated whit the content of the combobox text? Confused | :confused:


More on the same form

Private Sub .......()<br />
Dim o_rs        As New ADODB.Recordset  <br />
Dim s_Sql       As String<br />
<br />
	s_Sql = ""    <br />
	s_Sql = "Select * from ......"  <br />
<br />
	Set o_rs = New ADODB.Recordset  <br />
	Set o_rs = DBConnect.Execute(s_Sql)<br />
	.....<br />
	.....<br />
	<br />
	If mAutmoatico Then  ' mAutmoatico is boolean defined as global var<br />
		s_Sql = ""<br />
		s_Sql = "Select .....<br />
		s_Sql = s_Sql & "From ...."<br />
		s_Sql = "Where ...."<br />
		set o_rs = DBConnect.Execute(s_Sql)<br />
		....<br />
	End If


For some miraculous reason mAutmoatico is always false when reach the above If

Enjoy.




Habetis bona deum

GeneralRe: Give me a gun pliz Pin
Chris Meech23-Nov-07 7:54
Chris Meech23-Nov-07 7:54 
GeneralRe: Give me a gun pliz Pin
leppie23-Nov-07 13:27
leppie23-Nov-07 13:27 
GeneralRe: Give me a gun pliz Pin
Ri Qen-Sin24-Nov-07 5:51
Ri Qen-Sin24-Nov-07 5:51 
GeneralRe: Give me a gun pliz Pin
Pete O'Hanlon25-Nov-07 9:26
mvePete O'Hanlon25-Nov-07 9:26 
GeneralRe: Give me a gun pliz Pin
PeterMB25-Nov-07 10:09
professionalPeterMB25-Nov-07 10:09 
GeneralRe: Give me a gun pliz Pin
Paul Conrad25-Nov-07 11:13
professionalPaul Conrad25-Nov-07 11:13 
GeneralRe: Give me a gun pliz Pin
Vasudevan Deepak Kumar25-Nov-07 18:14
Vasudevan Deepak Kumar25-Nov-07 18:14 
GeneralAnyone have a clue what this code does? Pin
Joe Sonderegger22-Nov-07 3:26
Joe Sonderegger22-Nov-07 3:26 
GeneralRe: Anyone have a clue what this code does? Pin
Steve Hansen22-Nov-07 4:29
Steve Hansen22-Nov-07 4:29 
GeneralRe: Anyone have a clue what this code does? Pin
Luc Pattyn22-Nov-07 4:29
sitebuilderLuc Pattyn22-Nov-07 4:29 
GeneralRe: Anyone have a clue what this code does? Pin
DoomedOne22-Nov-07 5:11
DoomedOne22-Nov-07 5:11 
JokeRe: Anyone have a clue what this code does? Pin
KarstenK25-Nov-07 23:31
mveKarstenK25-Nov-07 23:31 
GeneralRe: Anyone have a clue what this code does? Pin
codemunkeh29-Nov-07 12:09
codemunkeh29-Nov-07 12:09 
JokeRe: Anyone have a clue what this code does? Pin
PIEBALDconsult22-Nov-07 6:05
mvePIEBALDconsult22-Nov-07 6:05 
JokeRe: Anyone have a clue what this code does? Pin
CPallini22-Nov-07 6:36
mveCPallini22-Nov-07 6:36 
GeneralRe: Anyone have a clue what this code does? Pin
Pete O'Hanlon22-Nov-07 10:32
mvePete O'Hanlon22-Nov-07 10:32 
GeneralRe: Anyone have a clue what this code does? Pin
Fatbuddha 122-Nov-07 21:48
Fatbuddha 122-Nov-07 21:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.