Charge detection in semiconductor nanostructures